]> granicus.if.org Git - postgis/commitdiff
Plug a couple of memory leaks
authorSandro Santilli <strk@keybit.net>
Sat, 17 Apr 2010 11:06:07 +0000 (11:06 +0000)
committerSandro Santilli <strk@keybit.net>
Sat, 17 Apr 2010 11:06:07 +0000 (11:06 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@5564 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/lwgeom_geos.c

index 57a04dd3d3f926809ff6c695499f017ed21bb62c..040b669dd25e0072fd9e4b545477d9b9083a0a8b 100644 (file)
@@ -3576,7 +3576,12 @@ LWGEOM2GEOS(LWGEOM *lwgeom)
                for (i=0; i<ngeoms; ++i)
                {
                        GEOSGeometry* g = LWGEOM2GEOS(lwc->geoms[i]);
-                       if ( ! g ) return NULL;
+                       if ( ! g )
+                       {
+                               while (i) GEOSGeom_destroy(geoms[--i]);
+                               free(geoms);
+                               return NULL;
+                       }
                        geoms[i] = g;
                }
                g = GEOSGeom_createCollection(geostype, geoms, ngeoms);