Changeset: d4d8d592e1f7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d4d8d592e1f7
Modified Files:
        monetdb5/modules/mal/batMask.c
        sql/storage/bat/bat_table.c
        sql/storage/bat/res_table.c
Branch: Jul2021
Log Message:

Adding missing unfixes


diffs (88 lines):

diff --git a/monetdb5/modules/mal/batMask.c b/monetdb5/modules/mal/batMask.c
--- a/monetdb5/modules/mal/batMask.c
+++ b/monetdb5/modules/mal/batMask.c
@@ -108,10 +108,10 @@ MSKumask(Client cntxt, MalBlkPtr mb, Mal
                BBPunfix(b->batCacheid);
                throw(MAL, "mask.umask", SQLSTATE(42000) "msk type input 
expected");
        }
-       if ((dst = BATunmask(b)) == NULL) {
-               BBPunfix(b->batCacheid);
+       dst = BATunmask(b);
+       BBPunfix(b->batCacheid);
+       if (dst == NULL)
                throw(MAL, "mask.umask", GDK_EXCEPTION);
-       }
        *ret=  dst->batCacheid;
        BBPkeepref(*ret);
        return MAL_SUCCEED;
diff --git a/sql/storage/bat/bat_table.c b/sql/storage/bat/bat_table.c
--- a/sql/storage/bat/bat_table.c
+++ b/sql/storage/bat/bat_table.c
@@ -318,14 +318,17 @@ table_orderby(sql_trans *tr, sql_table *
                bat_destroy(cr2);
                bat_destroy(lcb);
                bat_destroy(rcb);
-               if (ret != GDK_SUCCEED)
+               if (ret != GDK_SUCCEED) {
+                       bat_destroy(cl);
+                       bat_destroy(cr);
                        return NULL;
+               }
                lcb = BATproject(l, cl);
                rcb = BATproject(l, cr);
                bat_destroy(l);
+               bat_destroy(cl);
+               bat_destroy(cr);
                if (!lcb || !rcb) {
-                       bat_destroy(cl);
-                       bat_destroy(cr);
                        bat_destroy(lcb);
                        bat_destroy(rcb);
                        bat_destroy(r);
@@ -381,20 +384,30 @@ table_orderby(sql_trans *tr, sql_table *
        cl = r;
        /* project all in the new order */
        res_table *rt = res_table_create(tr, 1/*result_id*/, 1/*query_id*/, 
ol_length(t->columns), Q_TABLE, NULL, NULL);
+       if (!rt) {
+               bat_destroy(cl);
+               return NULL;
+       }
        rt->nr_rows = BATcount(cl);
        for (node *n = ol_first_node(t->columns); n; n = n->next) {
+               BAT *rc = NULL;
+
                o = n->data;
                b = full_column(tr, o);
                if (b)
-                       r = BATproject(cl, b);
+                       rc = BATproject(cl, b);
                bat_destroy(b);
-               if (!b || !r) {
+               if (!b || !rc) {
                        bat_destroy(cl);
                        bat_destroy(b);
                        res_table_destroy(rt);
                        return NULL;
                }
-               (void)res_col_create(tr, rt, t->base.name, o->base.name, 
o->type.type->base.name, o->type.type->digits, o->type.type->scale, TYPE_bat, 
r, true);
+               if (!res_col_create(tr, rt, t->base.name, o->base.name, 
o->type.type->base.name, o->type.type->digits, o->type.type->scale, TYPE_bat, 
rc, true)) {
+                       bat_destroy(cl);
+                       res_table_destroy(rt);
+                       return NULL;
+               }
        }
        bat_destroy(cl);
        return rt;
diff --git a/sql/storage/bat/res_table.c b/sql/storage/bat/res_table.c
--- a/sql/storage/bat/res_table.c
+++ b/sql/storage/bat/res_table.c
@@ -140,7 +140,8 @@ res_table_destroy(res_table *t)
        for (i = 0; i < t->nr_cols; i++) {
                res_col *c = t->cols + i;
 
-               res_col_destroy(c);
+               if (c)
+                       res_col_destroy(c);
        }
        if (t->order)
                bat_decref(t->order);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to