]> granicus.if.org Git - postgis/commitdiff
Fixed a segfault on geom_accum(NULL, NULL) condition
authorSandro Santilli <strk@keybit.net>
Mon, 28 Nov 2005 16:01:22 +0000 (16:01 +0000)
committerSandro Santilli <strk@keybit.net>
Mon, 28 Nov 2005 16:01:22 +0000 (16:01 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@2094 b70326c6-7e19-0410-871a-916f4a2858ee

CHANGES
lwgeom/lwgeom_functions_basic.c

diff --git a/CHANGES b/CHANGES
index 75a1f49a65c66923f972aefef3cac2d72d8e2608..3785d519eee620e8e3c775cf7d428af206f4566c 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -31,6 +31,7 @@ PostGIS 1.0.6CVS
        - Fixed palloc(0) call in collection deserializer (only gives
          problem with --enable-cassert)
        - Fixed bbox cache handling bugs
+       - Fixed geom_accum(NULL, NULL) segfault
 
 PostGIS 1.0.5
 2005/11/25
index a368ab0aef9c97e429674072b2683d21e12ecaf0..d1c0b43a52cd0d479effcc1048a1a3d3fa56cd19 100644 (file)
@@ -15,7 +15,7 @@
 #include "profile.h"
 #include "wktparse.h"
 
-//#define PGIS_DEBUG 1
+/*#define PGIS_DEBUG 1*/
 
 Datum LWGEOM_mem_size(PG_FUNCTION_ARGS);
 Datum LWGEOM_summary(PG_FUNCTION_ARGS);
@@ -2092,11 +2092,15 @@ Datum LWGEOM_accum(PG_FUNCTION_ARGS)
 #ifdef PGIS_DEBUG
                elog(NOTICE, "geom_accum: NULL geom, nelems=%d", nelems);
 #endif
+               if ( array == NULL ) PG_RETURN_NULL();
                PG_RETURN_ARRAYTYPE_P(array);
        }
 
        /* Make a DETOASTED copy of input geometry */
        geom = (PG_LWGEOM *)PG_DETOAST_DATUM(datum);
+#ifdef PGIS_DEBUG
+       elog(NOTICE, "geom_accum: detoasted geom: %x", geom);
+#endif
 
        /*
         * Might use a more optimized version instead of lwrealloc'ing