[postgis-commits] svn - r2994 - branches/1.3/lwgeom

postgis-commits at postgis.refractions.net postgis-commits at postgis.refractions.net
Tue Sep 23 12:09:31 PDT 2008


Author: pramsey
Date: 2008-09-23 12:09:31 -0700 (Tue, 23 Sep 2008)
New Revision: 2994

Modified:
   branches/1.3/lwgeom/lwgeom_rtree.c
Log:
reduce memory leak in P-i-P shortcut


Modified: branches/1.3/lwgeom/lwgeom_rtree.c
===================================================================
--- branches/1.3/lwgeom/lwgeom_rtree.c	2008-09-23 19:07:03 UTC (rev 2993)
+++ branches/1.3/lwgeom/lwgeom_rtree.c	2008-09-23 19:09:31 UTC (rev 2994)
@@ -448,6 +448,11 @@
 #ifdef PGIS_DEBUG
                 lwnotice("Polygon size mismatch, creating new cache.");
 #endif
+                for(i = 0; i < currentCache->ringCount; i++)
+                {
+                        freeTree(currentCache->ringIndices[i]);
+                }
+                lwfree(currentCache->ringIndices);
                 lwfree(currentCache->poly);
                 lwfree(currentCache);
                 return createNewCache(poly, serializedPoly);
@@ -461,6 +466,11 @@
 #ifdef PGIS_DEBUG
                         lwnotice("Polygon mismatch, creating new cache. %c, %c", a, b);
 #endif
+                        for(i = 0; i < currentCache->ringCount; i++)
+                        { 
+                                freeTree(currentCache->ringIndices[i]);
+                        }
+                        lwfree(currentCache->ringIndices);
                         lwfree(currentCache->poly);
                         lwfree(currentCache);
                         return createNewCache(poly, serializedPoly);



More information about the postgis-commits mailing list