Changeset: c9bc93109bc6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c9bc93109bc6
Modified Files:
        monetdb5/mal/mal_parser.c
        monetdb5/modules/atoms/json.c
        monetdb5/modules/mal/language.c
Branch: Jul2017
Log Message:

Resource issues.


diffs (82 lines):

diff --git a/monetdb5/mal/mal_parser.c b/monetdb5/mal/mal_parser.c
--- a/monetdb5/mal/mal_parser.c
+++ b/monetdb5/mal/mal_parser.c
@@ -948,9 +948,10 @@ static str parseModule(Client cntxt)
                return parseError(cntxt, "<module path> expected\n");
        modnme = putNameLen(nxt, l);
        advance(cntxt, l);
-       if( ! isModuleDefined(cntxt->nspace,modnme))
-               newModule(NULL,modnme);
-       cntxt->nspace = fixModule(cntxt->nspace, modnme);
+       if( ! isModuleDefined(cntxt->nspace,modnme) && strcmp(modnme, "user") 
!= 0)
+               cntxt->nspace = newModule(NULL,modnme);
+       else
+               cntxt->nspace = fixModule(cntxt->nspace, modnme);
        skipSpace(cntxt);
        helpInfo(cntxt, &cntxt->nspace->help);
        return "";
@@ -1110,8 +1111,8 @@ fcnHeader(Client cntxt, int kind)
        cntxt->backup = cntxt->curprg;
        cntxt->curprg = newFunction( modnme, fnme, kind);
        if(cntxt->curprg == NULL) {
+               cntxt->curprg = cntxt->backup;
                parseError(cntxt, MAL_MALLOC_FAIL);
-               cntxt->curprg = cntxt->backup;
                return 0;
        }
        curPrg = cntxt->curprg;
@@ -1583,7 +1584,7 @@ parseAssign(Client cntxt, int cntrl)
                                freeInstruction(curInstr);
                                return;
                        }
-                       GETvariable((void) 0);
+                       GETvariable(freeInstruction(curInstr));
                        if (currChar(cntxt) == ':') {
                                setVarUDFtype(curBlk, varid);
                                type = typeElm(cntxt, getVarType(curBlk, 
varid));
@@ -1637,7 +1638,7 @@ parseAssign(Client cntxt, int cntrl)
                }
 
                /* Get target variable details*/
-               GETvariable((void) 0);
+               GETvariable(freeInstruction(curInstr));
                if (!(currChar(cntxt) == ':' && CURRENT(cntxt)[1] == '=')) {
                        curInstr->argv[0] = varid;
                        if (currChar(cntxt) == ':') {
diff --git a/monetdb5/modules/atoms/json.c b/monetdb5/modules/atoms/json.c
--- a/monetdb5/modules/atoms/json.c
+++ b/monetdb5/modules/atoms/json.c
@@ -2206,7 +2206,7 @@ JSONjsonaggr(BAT **bnp, BAT *b, BAT *g, 
                                        }
                                } else {
                                        len = strlen(v);
-                                       if (len >= maxlen) {
+                                       if (len + 7 >= maxlen) {
                                                maxlen += len + BUFSIZ;
                                                buf2 = GDKrealloc(buf, maxlen);
                                                if (buf2 == NULL) {
@@ -2217,10 +2217,10 @@ JSONjsonaggr(BAT **bnp, BAT *b, BAT *g, 
                                        }
                                        switch (b->ttype) {
                                        case TYPE_str:
-                                               len = snprintf(buf, maxlen, "[ 
\"%s\" ]", v);
+                                               snprintf(buf, maxlen, "[ \"%s\" 
]", v);
                                                break;
                                        case TYPE_dbl:
-                                               len = snprintf(buf, maxlen, "[ 
%s ]", v);
+                                               snprintf(buf, maxlen, "[ %s ]", 
v);
                                                break;
                                        }
                                }
diff --git a/monetdb5/modules/mal/language.c b/monetdb5/modules/mal/language.c
--- a/monetdb5/modules/mal/language.c
+++ b/monetdb5/modules/mal/language.c
@@ -190,7 +190,7 @@ CMDregisterFunction(Client cntxt, MalBlk
                fcnName = putName(*fcn);
                modName = putName(*mod);
                ahelp = GDKstrdup(*help);
-               if(fcnName == NULL || modName == NULL || help == NULL) {
+               if(fcnName == NULL || modName == NULL || ahelp == NULL) {
                        freeSymbol(sym);
                        GDKfree(ahelp);
                        throw(MAL, "language.register", MAL_MALLOC_FAIL);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to