Changeset: 6cfd90913a77 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6cfd90913a77
Modified Files:
        monetdb5/modules/mal/xid.c
Branch: xid
Log Message:

inheritCOL(): improved sanity checks and prevent memory (Heap) leak


diffs (33 lines):

diff --git a/monetdb5/modules/mal/xid.c b/monetdb5/modules/mal/xid.c
--- a/monetdb5/modules/mal/xid.c
+++ b/monetdb5/modules/mal/xid.c
@@ -295,18 +295,21 @@ inheritCOL( BAT *bn, COLrec *cn, BAT *b,
        /* inherit column as view */
        str nme = cn->id;
 
-       assert((bn->H == cn && cn->type == TYPE_void) ||
-              (bn->T == cn && cn->type == TYPE_void));
-       assert(b->H  == c  || b->T  == c );
-       assert(p == 0 || p == VIEWhparent(b) || p == VIEWtparent(b));
-
-       if (p == 0)
-               p = b->batCacheid;
+       assert((b->H == c && p == VIEWhparent(b)) ||
+              (b->T == c && p == VIEWtparent(b)));
+       assert(bn->H == cn || bn->T == cn);
+       assert(cn->props == NULL);
+       assert(cn->vheap == NULL);
+       assert(cn->hash  == NULL);
        assert(bn->U->deleted  == b->U->deleted );
        assert(bn->U->first    == b->U->first   );
        assert(bn->U->inserted == b->U->inserted);
        assert(bn->U->count    == b->U->count   );
-       //assert(bn->U->capacity == b->U->capacity);
+
+       HEAPfree(&cn->heap);
+
+       if (p == 0)
+               p = b->batCacheid;
        bn->U->capacity = MIN( bn->U->capacity, b->U->capacity );
        *cn = *c;
        BBPshare(p);
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to