Changeset: 6cffd0b22e81 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/6cffd0b22e81
Modified Files:
        monetdb5/modules/mal/mat.c
        monetdb5/modules/mal/orderidx.c
Branch: Jul2021
Log Message:

On error, unfix


diffs (71 lines):

diff --git a/monetdb5/modules/mal/mat.c b/monetdb5/modules/mal/mat.c
--- a/monetdb5/modules/mal/mat.c
+++ b/monetdb5/modules/mal/mat.c
@@ -95,8 +95,8 @@ MATpackInternal(Client cntxt, MalBlkPtr 
                if (b != ob)
                        BBPunfix(ob->batCacheid);
        }
-       if( !(!bn->tnil || !bn->tnonil)){
-               BBPkeepref(*ret = bn->batCacheid);
+       if (!(!bn->tnil || !bn->tnonil)) {
+               BBPreclaim(bn);
                throw(MAL, "mat.pack", "INTERNAL ERROR" "bn->tnil or  
bn->tnonil fails ");
        }
        BBPkeepref(*ret = bn->batCacheid);
@@ -153,16 +153,18 @@ MATpackIncrement(Client cntxt, MalBlkPtr
                        throw(MAL, "mat.pack", GDK_EXCEPTION);
                }
                bn->unused = (pieces-1); /* misuse "unused" field */
-               *ret = bn->batCacheid;
                BATsettrivprop(bn);
-               BBPretain(bn->batCacheid);
-               BBPunfix(bn->batCacheid);
                if (b != ob)
                        BBPunfix(ob->batCacheid);
                if (b)
                        BBPunfix(b->batCacheid);
-               if( !(!bn->tnil || !bn->tnonil))
+               if (!(!bn->tnil || !bn->tnonil)) {
+                       BBPreclaim(bn);
                        throw(MAL, "mat.packIncrement", "INTERNAL ERROR" " 
bn->tnil %d bn->tnonil %d", bn->tnil, bn->tnonil);
+               }
+               *ret = bn->batCacheid;
+               BBPretain(bn->batCacheid);
+               BBPunfix(bn->batCacheid);
        } else {
                /* remaining steps */
                BAT *obb = bb = BATdescriptor(stk->stk[getArg(p,2)].val.ival);
@@ -183,12 +185,12 @@ MATpackIncrement(Client cntxt, MalBlkPtr
                if (bb != obb)
                        BBPunfix(obb->batCacheid);
                b->unused--;
-               if(b->unused == 0)
-                       if ((b = BATsetaccess(b, BAT_READ)) == NULL) {
-                               throw(MAL, "mat.pack", GDK_EXCEPTION);
-                       }
-               if( !(!b->tnil || !b->tnonil)){
-                       BBPkeepref(*ret = b->batCacheid);
+               if (b->unused == 0 && (b = BATsetaccess(b, BAT_READ)) == NULL) {
+                       BBPunfix(b->batCacheid);
+                       throw(MAL, "mat.pack", GDK_EXCEPTION);
+               }
+               if (!(!b->tnil || !b->tnonil)) {
+                       BBPunfix(b->batCacheid);
                        throw(MAL, "mat.pack", "INTERNAL ERROR" " b->tnil or  
b->tnonil fails ");
                }
                *ret = b->batCacheid;
diff --git a/monetdb5/modules/mal/orderidx.c b/monetdb5/modules/mal/orderidx.c
--- a/monetdb5/modules/mal/orderidx.c
+++ b/monetdb5/modules/mal/orderidx.c
@@ -357,8 +357,10 @@ OIDXmerge(Client cntxt, MalBlkPtr mb, Ma
        if (b == NULL)
                throw(MAL, "bat.orderidx", SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
 
-       if (b->torderidx )
+       if (b->torderidx) {
+               BBPunfix(bid);
                throw(MAL, "bat.orderidx", SQLSTATE(HY002) "INTERNAL ERROR, 
torderidx already set");
+       }
 
        switch (ATOMbasetype(b->ttype)) {
        case TYPE_bte:
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to