Changeset: 3ed03ce0819e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3ed03ce0819e
Modified Files:
        monetdb5/modules/mal/tablet.mx
        sql/backends/monet5/datacell/receptor.c
Branch: Aug2011
Log Message:

fixed recent leak fix

Since changeset 41611af56f47 ("fix leak of types in tablet"), fmt[*].type is
GDKfree()'ed for clean up; thus, we also need to ensure that it always
indeed points to GDKmalloc()'ed memory.

Triggered by test monetdb5/modules/mal/Tests/ascii_io2.mal failing with
"mserver5: .../MonetDB/gdk/gdk_utils.mx:1261: GDKfree_: Assertion `(size & 2) 
== 0' failed."
(with assertions enabled)
respectively
"*** glibc detected *** mserver5: free(): invalid pointer: 0x0000000002a4ca00 
***"
(with assertions disabled).


diffs (33 lines):

diff --git a/monetdb5/modules/mal/tablet.mx b/monetdb5/modules/mal/tablet.mx
--- a/monetdb5/modules/mal/tablet.mx
+++ b/monetdb5/modules/mal/tablet.mx
@@ -1141,7 +1141,7 @@ create_loadformat(Tablet * as, BAT *name
                fmt[p].name = (char *) bun_tail(names, p);
                fmt[p].sep = sep_dup((char *) bun_tail(seps, p));
                fmt[p].seplen = (int) strlen(fmt[p].sep);
-               fmt[p].type = (char *) bun_tail(types, p);
+               fmt[p].type = GDKstrdup((char *) bun_tail(types, p));
                fmt[p].adt = ATOMindex(fmt[p].type);
                if (fmt[p].adt <= 0) {
                        GDKerror("create_loadformat: %s has unknown type %s 
(using str instead).\n", fmt[p].name, fmt[p].name);
@@ -1195,7 +1195,7 @@ create_dumpformat(Tablet * as, BAT *name
                        fmt[p].name = (char *) bun_tail(names, p);
                fmt[p].sep = sep_dup((char *) bun_tail(seps, p));
                fmt[p].seplen = (int) strlen(fmt[p].sep);
-               fmt[p].type = ATOMname(b->ttype);
+               fmt[p].type = GDKstrdup(ATOMname(b->ttype));
                fmt[p].adt = (b)->ttype;
                fmt[p].tostr = &TABLETadt_toStr;
                fmt[p].frstr = &TABLETadt_frStr;
diff --git a/sql/backends/monet5/datacell/receptor.c 
b/sql/backends/monet5/datacell/receptor.c
--- a/sql/backends/monet5/datacell/receptor.c
+++ b/sql/backends/monet5/datacell/receptor.c
@@ -182,7 +182,7 @@ DCreceptorNew(int *ret, str *tbl, str *h
                fmt[j].name = GDKstrdup(baskets[idx].cols[i]);
                fmt[j].sep = GDKstrdup(",");
                fmt[j].seplen = 1;
-               fmt[j].type = ATOMname(b->ttype);
+               fmt[j].type = GDKstrdup(ATOMname(b->ttype));
                fmt[j].adt = (b)->ttype;
                fmt[j].tostr = &TABLETadt_toStr;
                fmt[j].frstr = &TABLETadt_frStr;
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to