]> granicus.if.org Git - postgis/commitdiff
Fix memory leak in lwcollection_homogenize
authorSandro Santilli <strk@keybit.net>
Fri, 21 Dec 2012 10:53:12 +0000 (10:53 +0000)
committerSandro Santilli <strk@keybit.net>
Fri, 21 Dec 2012 10:53:12 +0000 (10:53 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@10896 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/lwhomogenize.c

index f2ee9dc5f70b861cea9103c248cab1e72af16bf5..f7e580e3bfabcae35b0d66b2a414f68fe8f2116f 100644 (file)
@@ -139,7 +139,7 @@ lwcollection_homogenize(const LWCOLLECTION *col)
                if ( outcol->ngeoms == 1 )
                {
                        outgeom = outcol->geoms[0];
-                       lwfree(outcol);
+                       outcol->ngeoms=0; lwcollection_free(outcol);
                }
                else
                {
@@ -161,7 +161,7 @@ lwcollection_homogenize(const LWCOLLECTION *col)
                                if ( bcol->ngeoms == 1 )
                                {
                                        lwcollection_add_lwgeom(outcol, bcol->geoms[0]);
-                                       lwfree(bcol);
+                                       bcol->ngeoms=0; lwcollection_free(bcol);
                                }
                                else 
                                {
@@ -171,7 +171,7 @@ lwcollection_homogenize(const LWCOLLECTION *col)
                }
                outgeom = lwcollection_as_lwgeom(outcol);
        }
-       
+
        return outgeom;
 }