Changeset: 2e99f5ccc485 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2e99f5ccc485
Modified Files:
        gdk/gdk_bbp.c
        monetdb5/mal/mal_import.c
        monetdb5/mal/mal_instruction.c
        monetdb5/modules/atoms/str.c
        monetdb5/modules/mal/bbp.c
        monetdb5/optimizer/opt_accumulators.c
        monetdb5/optimizer/opt_aliases.c
        monetdb5/scheduler/srvpool.c
Branch: Jan2014
Log Message:

More Coverity issues


diffs (121 lines):

diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -3620,7 +3620,6 @@ BBPdiskscan(const char *parent)
                const char *p;
                bat bid;
                int ok, delete;
-               struct stat st;
 
                if (dent->d_name[0] == '.')
                        continue;       /* ignore .dot files and directories (. 
..) */
diff --git a/monetdb5/mal/mal_import.c b/monetdb5/mal/mal_import.c
--- a/monetdb5/mal/mal_import.c
+++ b/monetdb5/mal/mal_import.c
@@ -202,7 +202,8 @@ malInclude(Client c, str name, int listi
                        if ((s = malLoadScript(c, filename, &c->fdin)) == 0) {
                                parseMAL(c, c->curprg);
                                bstream_destroy(c->fdin);
-                       }
+                       } else
+                               GDKfree(s); // not interested in error here
                        if (p)
                                filename = p + 1;
                } while (p);
diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c
--- a/monetdb5/mal/mal_instruction.c
+++ b/monetdb5/mal/mal_instruction.c
@@ -399,8 +399,10 @@ trimexpand(MalBlkPtr mb, int varsize, in
                return;
        len = sizeof(InstrPtr) * (mb->ssize + stmtsize);
        stmt = (InstrPtr *) GDKzalloc(len);
-       if (stmt == NULL)
+       if (stmt == NULL){
+               GDKfree(v);
                return;
+       }
 
        memcpy((str) v, (str) mb->var, sizeof(ValPtr) * mb->vtop);
 
@@ -1817,6 +1819,7 @@ pushInstruction(MalBlkPtr mb, InstrPtr p
                        mb->profiler = (ProfPtr) GDKzalloc((mb->ssize + 
STMT_INCREMENT) * sizeof(ProfRecord));
                        if ( mb->profiler == NULL){
                                mb->errors++;
+                               GDKfree(newblk);
                                showException(GDKout, MAL, "pushInstruction", 
MAL_MALLOC_FAIL);
                                return;
                        }
diff --git a/monetdb5/modules/atoms/str.c b/monetdb5/modules/atoms/str.c
--- a/monetdb5/modules/atoms/str.c
+++ b/monetdb5/modules/atoms/str.c
@@ -1476,6 +1476,7 @@ strIconv(str *res, str org, str f, str t
        if (iconv(cd, &from, &len, &r, &size) == (size_t) - 1) {
                GDKfree(*res);
                *res = NULL;
+               iconv_close(cd);
                GDKerror("strIconv: String conversion failed from (%s) to 
(%s)\n", f, t);
                return GDK_FAIL;
        }
diff --git a/monetdb5/modules/mal/bbp.c b/monetdb5/modules/mal/bbp.c
--- a/monetdb5/modules/mal/bbp.c
+++ b/monetdb5/modules/mal/bbp.c
@@ -390,7 +390,8 @@ CMDdecompressheap(Heap *h, Heap *hn, str
                close_stream(fp);
                return 1;
        }
-       close_stream(fp);
+       if(fp)
+               close_stream(fp);
 #else
        (void) h;
        (void) hn;
diff --git a/monetdb5/optimizer/opt_accumulators.c 
b/monetdb5/optimizer/opt_accumulators.c
--- a/monetdb5/optimizer/opt_accumulators.c
+++ b/monetdb5/optimizer/opt_accumulators.c
@@ -49,8 +49,10 @@ OPTaccumulatorsImplementation(Client cnt
        old= mb->stmt;
        limit= mb->stop;
        slimit= mb->ssize;
-       if ( newMalBlkStmt(mb,mb->stop) < 0)
+       if ( newMalBlkStmt(mb,mb->stop) < 0){
+               GDKfree(span);
                return 0;
+       }
        for (i = 0; i < limit; i++) {
                p = old[i];
 
diff --git a/monetdb5/optimizer/opt_aliases.c b/monetdb5/optimizer/opt_aliases.c
--- a/monetdb5/optimizer/opt_aliases.c
+++ b/monetdb5/optimizer/opt_aliases.c
@@ -50,8 +50,10 @@ OPTaliasesImplementation(Client cntxt, M
                return 0;
 
        alias= (int*) GDKmalloc(sizeof(int)* mb->vtop);
-       if (alias == NULL)
+       if (alias == NULL){
+               GDKfree(span);
                return 0;
+       }
        for(i=0; i<mb->vtop; i++) alias[i]=i;
 
        limit = mb->stop;
diff --git a/monetdb5/scheduler/srvpool.c b/monetdb5/scheduler/srvpool.c
--- a/monetdb5/scheduler/srvpool.c
+++ b/monetdb5/scheduler/srvpool.c
@@ -259,7 +259,7 @@ SRVPOOLdiscover(Client cntxt)
        BUN p,q;
        str msg = MAL_SUCCEED, conn, scen = "msql";
        BATiter bi;
-       int j;
+       int j = -1;
        char buf[BUFSIZ], *s= buf, *dbname;
 
 
@@ -331,6 +331,7 @@ SRVPOOLdiscover(Client cntxt)
                if ( msg == MAL_SUCCEED ) {
                        servers[j].conn = GDKstrdup(conn);
 #ifdef DEBUG_RUN_SRVPOOL
+               if( j>=0) 
                        mnstr_printf(cntxt->fdout,"#Worker site %d connection 
%s %s\n", j, servers[j].conn, s);
 #endif
                } else
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to