Changeset: 6905fa1a1cb9 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6905fa1a1cb9
Modified Files:
        monetdb5/optimizer/opt_mergetable.c
Branch: Jun2016
Log Message:

fixed leak


diffs (44 lines):

diff --git a/monetdb5/optimizer/opt_mergetable.c 
b/monetdb5/optimizer/opt_mergetable.c
--- a/monetdb5/optimizer/opt_mergetable.c
+++ b/monetdb5/optimizer/opt_mergetable.c
@@ -632,17 +632,19 @@ mat_join2(MalBlkPtr mb, InstrPtr p, matl
 static int
 subjoin_split(Client cntxt, InstrPtr p, int args)
 {
-       char *name;
+       char *name = NULL;
        int len, i, res = 0;
        Symbol sym;
        MalBlkPtr mb;
        InstrPtr q;
 
-       if (args <= 2) /* we asume there are no 2x1 joins! */
+       if (args <= 3) /* we asume there are no 2x1 joins! */
                return 1;
 
        len = strlen( getFunctionId(p) );
        name = GDKmalloc(len+3);
+       if (!name)
+               return -1;
        strncpy(name, getFunctionId(p), len-7);
        strcpy(name+len-7, "subselect");
 
@@ -657,6 +659,7 @@ subjoin_split(Client cntxt, InstrPtr p, 
                else 
                        break;
        }
+       GDKfree(name);
        return res-1;
 }
 
@@ -700,6 +703,10 @@ mat_joinNxM(Client cntxt, MalBlkPtr mb, 
                int split = subjoin_split(cntxt, p, args);
                int nr_mv1 = split, nr_mv2 = nr_mats-split;
 
+               if (split < 0) {
+                       mb->errors++;
+                       return ;
+               }
                /* now detect split point */
                for(k=1; k<mat[mv1].mi->argc; k++) {
                        for (j=1; j<mat[mv2].mi->argc; j++) {
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to