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

Some defensive lines


diffs (51 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
@@ -104,8 +104,11 @@ MSKumask(Client cntxt, MalBlkPtr mb, Mal
        bid = getArgReference_bat(stk, pci, 1);
        if ((b = BATdescriptor(*bid)) == NULL)
                throw(SQL, "bat.umask", SQLSTATE(HY002) RUNTIME_OBJECT_MISSING);
-       dst = BATunmask(b);
-       if (dst == NULL) {
+       if (b->ttype != TYPE_msk && !mask_cand(b)) {
+               BBPunfix(b->batCacheid);
+               throw(MAL, "mask.umask", SQLSTATE(42000) "msk type input 
expected");
+       }
+       if ((dst = BATunmask(b)) == NULL) {
                BBPunfix(b->batCacheid);
                throw(MAL, "mask.umask", GDK_EXCEPTION);
        }
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
@@ -1042,13 +1042,19 @@ cs_update_bat( sql_trans *tr, column_sto
        }
        if (updates && (updates->ttype == TYPE_msk || mask_cand(updates))) {
                oupdates = BATunmask(updates);
-               if (!oupdates)
+               if (!oupdates) {
+                       if (otids != tids)
+                               bat_destroy(otids);
                        return LOG_ERR;
+               }
        }
        if (updates && updates->ttype == TYPE_void) { /* dense later use 
optimized log structure */
                oupdates = COLcopy(updates, TYPE_oid, true /* make sure we get 
a oid col */, TRANSIENT);
-               if (!oupdates)
+               if (!oupdates) {
+                       if (otids != tids)
+                               bat_destroy(otids);
                        return LOG_ERR;
+               }
        }
        /* When we go to smaller grained update structures we should check for 
concurrent updates on this column ! */
        /* currently only one update delta is possible */
@@ -1060,6 +1066,8 @@ cs_update_bat( sql_trans *tr, column_sto
                        if (BATsort(&sorted, &order, NULL, otids, NULL, NULL, 
false, false, false) != GDK_SUCCEED) {
                                if (otids != tids)
                                        bat_destroy(otids);
+                               if (oupdates != updates)
+                                       bat_destroy(oupdates);
                                unlock_table(tr->store, t->base.id);
                                return LOG_ERR;
                        }
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to