]> granicus.if.org Git - postgis/commitdiff
Fixed 0-size allocation in lwcollection deserializer
authorSandro Santilli <strk@keybit.net>
Fri, 25 Nov 2005 15:27:39 +0000 (15:27 +0000)
committerSandro Santilli <strk@keybit.net>
Fri, 25 Nov 2005 15:27:39 +0000 (15:27 +0000)
(only matters when backend is compiled with --enable-cassert)

git-svn-id: http://svn.osgeo.org/postgis/branches/pgis_1_0@2070 b70326c6-7e19-0410-871a-916f4a2858ee

CHANGES
lwgeom/lwcollection.c

diff --git a/CHANGES b/CHANGES
index 499984a051050f246ab7b5468ec316763cef8535..8b8a0f8488e75de734e395e861e0c396ae1843ae 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+PostGIS 1.0.6CVS
+       - Fixed palloc(0) call in collection deserializer (only gives
+         problem with --enable-cassert)
+
 PostGIS 1.0.5
 2005/11/25
        - New "Reporting Bugs" chapter in manual
index c6f62c1a6dfe0c3646abaf47fa6d1d3ad72a248b..edbab1ef5ff9c820484306e2d20e3cd00da8e0ae 100644 (file)
@@ -84,7 +84,6 @@ lwcollection_deserialize(uchar *srl)
        result->type = typefl;
        result->SRID = insp->SRID;
        result->ngeoms = insp->ngeometries;
-       result->geoms = lwalloc(sizeof(LWGEOM *)*insp->ngeometries);
 
        if (lwgeom_hasBBOX(srl[0]))
        {
@@ -95,9 +94,14 @@ lwcollection_deserialize(uchar *srl)
        else result->bbox = NULL;
 
 
-       for (i=0; i<insp->ngeometries; i++)
+       if ( insp->ngeometries )
        {
-               result->geoms[i] = lwgeom_deserialize(insp->sub_geoms[i]);
+               result->geoms = lwalloc(sizeof(LWGEOM *)*insp->ngeometries);
+               for (i=0; i<insp->ngeometries; i++)
+               {
+                       result->geoms[i] =
+                               lwgeom_deserialize(insp->sub_geoms[i]);
+               }
        }
 
        return result;