Changeset: 4d49c9f991b3 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4d49c9f991b3
Modified Files:
        monetdb5/mal/mal_factory.c
        monetdb5/mal/mal_linker.c
        monetdb5/mal/mal_module.c
        monetdb5/mal/mal_parser.c
        monetdb5/mal/mal_session.c
Branch: Jan2014
Log Message:

Minor bug fixed discovered by Coverity


diffs (117 lines):

diff --git a/monetdb5/mal/mal_factory.c b/monetdb5/mal/mal_factory.c
--- a/monetdb5/mal/mal_factory.c
+++ b/monetdb5/mal/mal_factory.c
@@ -471,8 +471,10 @@ newPlant(MalBlkPtr mb)
        for (p = plants; p < plim && p->factory; p++)
                ;
        stk = newGlobalStack(mb->vsize);
-       if (lastPlant == MAXPLANTS || stk == NULL)
+       if (lastPlant == MAXPLANTS || stk == NULL){
+               if( stk) GDKfree(stk);
                return 0;
+       }
        if (p == plim)
                lastPlant++;
        p->factory = mb;
diff --git a/monetdb5/mal/mal_linker.c b/monetdb5/mal/mal_linker.c
--- a/monetdb5/mal/mal_linker.c
+++ b/monetdb5/mal/mal_linker.c
@@ -156,9 +156,12 @@ getAddress(stream *out, str filename, st
                if( adr != NULL)
                        return adr; /* found it */
        }
-       if (!silent)
+       if (!silent){
+               if ( dl)
+                       dlclose(dl);
                showException(out, MAL,"MAL.getAddress", "address of '%s.%s' 
not found",
                        (modnme?modnme:"<unknown>"), fcnname);
+       }
        return NULL;
 }
 /*
@@ -448,6 +451,7 @@ locate_file(const char *basename, const 
                                                while (lasts >= 0)
                                                        GDKfree(strs[lasts--]);
                                                GDKfree(fullname);
+                                               (void)closedir(rdir);
                                                return NULL;
                                        }
                                        sprintf(strs[lasts], "%s%c%s%c", 
fullname, DIR_SEP, e->d_name, PATH_SEP);
diff --git a/monetdb5/mal/mal_module.c b/monetdb5/mal/mal_module.c
--- a/monetdb5/mal/mal_module.c
+++ b/monetdb5/mal/mal_module.c
@@ -852,7 +852,7 @@ char **getHelp(Module m, str inputpat, i
        Symbol s;
        size_t len1 = 0,len2 = 0;
        int fnd=0;
-       char *t, **msg, buf[1024];
+       char *t, **msg, buf[1024]={0};
        int top=0, i,j,k, sig = 0, doc = 0;
        int maxhelp= MAXHELP;
 
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
@@ -831,9 +831,10 @@ propList(Client cntxt, int arg)
                                advance(cntxt, i);
                                if (currChar(cntxt) == ':') {
                                        tpe = simpleTypeId(cntxt);
-                                       if (tpe != TYPE_any)
-                                               convertConstant(tpe, &cst);
-                                       else
+                                       if (tpe != TYPE_any){
+                                               str msg =convertConstant(tpe, 
&cst);
+                                               if( msg) GDKfree(msg);
+                                       } else
                                                parseError(cntxt, "simple type 
expected\n");
                                }
                                varSetProperty(curBlk, arg, pname, opname, 
&cst);
@@ -1016,8 +1017,10 @@ parseLibrary(Client cntxt)
                libnme = putName(nxt, l);
        s = loadLibrary(libnme, TRUE);
        libnme = putName(nxt, l);
-       if (s)
+       if (s){
                mnstr_printf(cntxt->fdout, "#WARNING: %s\n", s);
+               GDKfree(s);
+       }
        advance(cntxt, l);
        return "";
 }
diff --git a/monetdb5/mal/mal_session.c b/monetdb5/mal/mal_session.c
--- a/monetdb5/mal/mal_session.c
+++ b/monetdb5/mal/mal_session.c
@@ -40,13 +40,14 @@ int
 malBootstrap(void)
 {
        Client c;
-       str bootfile = "mal_init", s;
+       str msg, bootfile = "mal_init", s;
 
        c = MCinitClient((oid) 0, 0, 0);
        assert(c != NULL);
        c->nspace = newModule(NULL, putName("user", 4));
        initLibraries();
-       if (defaultScenario(c)) {
+       if ( (msg = defaultScenario(c)) ) {
+               GDKfree(msg);
                GDKerror("Failed to initialise default scenario");
                return 0;
        }
@@ -249,6 +250,7 @@ MSscheduleClient(str command, str challe
                if (err != MAL_SUCCEED) {
                        mnstr_printf(fout, "!%s\n", err);
                        exit_streams(fin, fout);
+                       GDKfree(err);
                        GDKfree(command);
                        return;
                }
@@ -447,6 +449,7 @@ MSserveClient(void *dummy)
        if (msg) {
                showException(c->fdout, MAL, "serveClient", "could not 
initialize default scenario");
                c->mode = FINISHCLIENT + 1; /* == RUNCLIENT */
+               GDKfree(msg);
        } else {
                do {
                        do {
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to