Changeset: 70547d31b0fc for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=70547d31b0fc
Modified Files:
        gdk/gdk_bat.c
Branch: default
Log Message:

Free memory in case of error.


diffs (28 lines):

diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -196,18 +196,20 @@ BATnewstorage(oid hseq, int tt, BUN cap,
 
        /* alloc the main heaps */
        if (tt && HEAPalloc(&bn->theap, cap, bn->twidth) != GDK_SUCCEED) {
-               return NULL;
+               goto bailout;
        }
 
        if (ATOMheap(tt, bn->tvheap, cap) != GDK_SUCCEED) {
-               if (tt)
-                       HEAPfree(&bn->theap, 1);
                GDKfree(bn->tvheap);
-               return NULL;
+               goto bailout;
        }
        DELTAinit(bn);
        BBPcacheit(bn, 1);
        return bn;
+  bailout:
+       HEAPfree(&bn->theap, 1);
+       GDKfree(bn);
+       return NULL;
 }
 
 BAT *
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to