Changeset: 974c5e804dde for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/974c5e804dde
Modified Files:
        sql/storage/bat/bat_storage.c
        sql/storage/bat/bat_utils.c
Branch: Jul2021
Log Message:

Even more missing checks


diffs (40 lines):

diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c
--- a/sql/storage/bat/bat_storage.c
+++ b/sql/storage/bat/bat_storage.c
@@ -314,8 +314,10 @@ segments2cs(sql_trans *tr, segments *seg
        segment *s = segs->h;
 
        size_t nr = segs_end(segs, tr, t);
-       if (nr >= BATcapacity(b) && BATextend(b, nr) != GDK_SUCCEED)
+       if (nr >= BATcapacity(b) && BATextend(b, nr) != GDK_SUCCEED) {
+               bat_destroy(b);
                return LOG_ERR;
+       }
 
        if (nr > BATcount(b))
                BATsetcount(b, nr);
diff --git a/sql/storage/bat/bat_utils.c b/sql/storage/bat/bat_utils.c
--- a/sql/storage/bat/bat_utils.c
+++ b/sql/storage/bat/bat_utils.c
@@ -75,15 +75,15 @@ temp_copy(log_bid b, int temp)
        if (!o)
                return BID_NIL;
        if (!temp) {
-               c = COLcopy(o, o->ttype, true, PERSISTENT);
-               if (!c)
+               if (!(c = COLcopy(o, o->ttype, true, PERSISTENT))) {
+                       bat_destroy(o);
                        return BID_NIL;
+               }
                bat_set_access(c, BAT_READ);
                BATcommit(c, BUN_NONE);
-       } else {
-               c = bat_new(o->ttype, COLSIZE, PERSISTENT);
-               if (!c)
-                       return BID_NIL;
+       } else if (!(c = bat_new(o->ttype, COLSIZE, PERSISTENT))) {
+               bat_destroy(o);
+               return BID_NIL;
        }
        r = temp_create(c);
        bat_destroy(c);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to