Changeset: abdef4a48d66 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=abdef4a48d66
Modified Files:
        monetdb5/modules/mal/remote.c
        tools/monetdbe/monetdbe.c
Branch: monetdbe-proxy
Log Message:

Fix off-by-one memory issue.


diffs (47 lines):

diff --git a/monetdb5/modules/mal/remote.c b/monetdb5/modules/mal/remote.c
--- a/monetdb5/modules/mal/remote.c
+++ b/monetdb5/modules/mal/remote.c
@@ -1183,19 +1183,21 @@ static str RMTregisterInternal(Client cn
                return tmp;
        }
        
-       *fcn_id = GDKmalloc(strlen(ident));
+       *fcn_id = GDKstrdup(ident);
        if (*fcn_id == NULL) {
                return createException(MAL, "Remote register", MAL_MALLOC_FAIL);
        }
 
-       strcpy(*fcn_id, ident);
-
        Symbol prg;
 
        if ((prg = newFunction(putName(mod), putName(*fcn_id), FUNCTIONsymbol)) 
== NULL) {
                return createException(MAL, "Remote register", MAL_MALLOC_FAIL);
        }
 
+       // We only need the Symbol not the inner program stub. So we clear it.
+       freeMalBlk(prg->def);
+       prg->def = NULL;
+
        if ((prg->def = copyMalBlk(sym->def)) == NULL) {
                freeSymbol(prg);
                return createException(MAL, "Remote register", MAL_MALLOC_FAIL);
diff --git a/tools/monetdbe/monetdbe.c b/tools/monetdbe/monetdbe.c
--- a/tools/monetdbe/monetdbe.c
+++ b/tools/monetdbe/monetdbe.c
@@ -2073,14 +2073,7 @@ remote_cleanup:
                        goto cleanup;
                }
 
-               MalStkPtr stk = prepareMALstack(mb, mb->vsize);
-               stk->keepAlive = TRUE;
-
-               mdbe->msg = runMAL(mdbe->c, mb, 0, stk);
-
-               // TODO: figure out what goes wrong during garbage collection
-               // garbageCollector(mdbe->c, mb, stk, TRUE);
-               // freeStack(stk);
+               mdbe->msg = runMAL(mdbe->c, mb, 0, NULL);
                freeSymbol(prg);
        }
 
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to