]> granicus.if.org Git - postgis/commitdiff
Have lwcollection_extract clone (shallow) the extracted components. Safely lwgeom_fre...
authorSandro Santilli <strk@keybit.net>
Wed, 6 Jul 2011 14:45:22 +0000 (14:45 +0000)
committerSandro Santilli <strk@keybit.net>
Wed, 6 Jul 2011 14:45:22 +0000 (14:45 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@7610 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/cunit/cu_libgeom.c
liblwgeom/lwcollection.c

index da38c5b6eb8a640a51fa96e8f1b244370d6adea0..2b0f3580961b07cb65614e5fba5b7fafbd506a18 100644 (file)
@@ -328,7 +328,7 @@ static void test_lwcollection_extract(void)
        /* How to properly release 'col' ? 
         * See http://http://trac.osgeo.org/postgis/ticket/1102
         */
-       lwfree(col);
+       lwcollection_free(col);
        lwgeom_free(geom);
 
 }
index b681f80c652d78bd1c2e877fb03dbfc54f9cb191..b0d4b3b10adc57ba48d11c2abebe62e559a8b0fa 100644 (file)
@@ -580,7 +580,7 @@ LWCOLLECTION* lwcollection_extract(LWCOLLECTION *col, int type)
                                geomlistsize *= 2;
                                geomlist = lwrealloc(geomlist, sizeof(LWGEOM*) * geomlistsize);
                        }
-                       geomlist[geomlistlen] = col->geoms[i];
+                       geomlist[geomlistlen] = lwgeom_clone(col->geoms[i]);
                        geomlistlen++;
                }
                /* Recurse into sub-collections */