Update of /cvsroot/monetdb/pathfinder/modules/pftijah
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv29644

Modified Files:
        pftijah.mx 
Log Message:
make sure to free allocated data structures when leaving the Tijah algorithms
unexpected.



U pftijah.mx
Index: pftijah.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/modules/pftijah/pftijah.mx,v
retrieving revision 1.212
retrieving revision 1.213
diff -u -d -r1.212 -r1.213
--- pftijah.mx  25 Feb 2009 14:43:19 -0000      1.212
+++ pftijah.mx  26 Feb 2009 10:40:57 -0000      1.213
@@ -4798,17 +4798,20 @@
        
        ressize = BATcount(tidpre) + BATcount(oldpre);
        newpre = BATnew(TYPE_void, TYPE_oid, ressize);
-        if (res == NULL) 
+        if (newpre == NULL) 
         { 
                GDKerror("%s: could not allocate a result BAT[void,oid] of size 
%d.\n", name, ressize);
-               return(GDK_FAIL);
+               BATfree(res);
+                return(GDK_FAIL);
         }
        
        ressize = *indsize;
        newindex = BATnew(TYPE_void, TYPE_oid, ressize);
-        if (res == NULL) 
+        if (newindex == NULL) 
         { 
                GDKerror("%s: could not allocate a result BAT[void,oid] of size 
%d.\n", name, ressize);
+               BATfree(res);
+               BATfree(newpre);
                return(GDK_FAIL);
         }
        
@@ -4936,24 +4939,30 @@
        
        ressize = BATcount(tidpre) + BATcount(oldpre);
        newpre = BATnew(TYPE_void, TYPE_oid, ressize);
-        if (res == NULL) 
+        if (newpre == NULL) 
         { 
                GDKerror("%s: could not allocate a result BAT[void,oid] of size 
%d.\n", name, ressize);
-               return(GDK_FAIL);
+               BATfree(res);
+                return(GDK_FAIL);
         }
        
        newsize = BATnew(TYPE_void, TYPE_int, ressize);
-        if (res == NULL) 
+        if (newsize == NULL) 
         { 
                GDKerror("%s: could not allocate a result BAT[void,int] of size 
%d.\n", name, ressize);
+               BATfree(res);
+               BATfree(newpre);
                return(GDK_FAIL);
         }
        
        ressize = *indsize;
        newindex = BATnew(TYPE_void, TYPE_oid, ressize);
-        if (res == NULL) 
+        if (newindex == NULL) 
         { 
                GDKerror("%s: could not allocate a result BAT[void,oid] of size 
%d.\n", name, ressize);
+               BATfree(res);
+               BATfree(newpre);
+               BATfree(newsize);
                return(GDK_FAIL);
         }
        
@@ -5109,6 +5118,7 @@
         if (res == NULL) 
         { 
                GDKerror("%s: could not allocate a result BAT[oid,oid] of size 
%d.\n", name, ressize);
+               GDKfree(ind);
                return(GDK_FAIL);
         }
        sdst = hdst = (oid*)Hloc(res, BUNlast(res));
@@ -5225,6 +5235,7 @@
     if (res == NULL) 
     { 
        GDKerror("%s: could not allocate result BAT.\n", name);
+       GDKfree(stack);
        return(GDK_FAIL);
     }
     free = BATcapacity(res);
@@ -5264,6 +5275,8 @@
            stack[stack_top++] = new_stack_item;
            if (stack_top >= max_stack_size) {
                GDKerror("%s: ancestor stack grew beyond stack-size.\n", name);
+               GDKfree(stack);
+               BATfree(res);
                return(GDK_FAIL);
            }
        }
@@ -5283,6 +5296,8 @@
         if (res == NULL)
        { 
                  GDKerror("%s: could not extend result BAT.\n", name);
+          GDKfree(stack);
+          BATfree(res);
           return(GDK_FAIL);
        }
         sdst = (oid*)Hloc(res, BUNfirst(res));
@@ -5373,6 +5388,7 @@
     if (res == NULL) 
     { 
        GDKerror("%s: could not allocate result BAT.\n", name);
+       GDKfree(stack); 
        return(GDK_FAIL);
     }
     free = BATcapacity(res);
@@ -5412,6 +5428,8 @@
            stack[stack_top++] = new_stack_item;
            if (stack_top >= max_stack_size) {
                GDKerror("%s: ancestor stack grew beyond stack-size.\n", name);
+               GDKfree(stack);
+               BATfree(res); 
                return(GDK_FAIL);
            }
        }
@@ -5431,6 +5449,8 @@
         if (res == NULL)
        { 
                  GDKerror("%s: could not extend result BAT.\n", name);
+          GDKfree(stack);
+          BATfree(res); 
           return(GDK_FAIL);
        }
         sdst = (oid*)Hloc(res, BUNfirst(res));
@@ -5518,6 +5538,7 @@
     if (res == NULL) 
     { 
        GDKerror("%s: could not allocate result BAT.\n", name);
+       GDKfree(stack);
        return(GDK_FAIL);
     }
     free = BATcapacity(res);
@@ -5557,6 +5578,8 @@
            stack[stack_top++] = new_stack_item;
            if (stack_top >= max_stack_size) {
                GDKerror("%s: ancestor stack grew beyond stack-size.\n", name);
+               GDKfree(stack);
+               BATfree(res);
                return(GDK_FAIL);
            }
        }
@@ -5576,6 +5599,8 @@
         if (res == NULL)
        { 
                  GDKerror("%s: could not extend result BAT.\n", name);
+          GDKfree(stack);
+          BATfree(res);
           return(GDK_FAIL);
        }
         sdst = (oid*)Hloc(res, BUNfirst(res));


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to