From: Sandro Santilli Date: Mon, 28 Nov 2005 16:01:22 +0000 (+0000) Subject: Fixed a segfault on geom_accum(NULL, NULL) condition X-Git-Tag: pgis_1_1_0~124 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1b89016cf710a1eb268ba81d73cfcefcf0711fc3;p=postgis Fixed a segfault on geom_accum(NULL, NULL) condition git-svn-id: http://svn.osgeo.org/postgis/trunk@2094 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/CHANGES b/CHANGES index 75a1f49a6..3785d519e 100644 --- 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 diff --git a/lwgeom/lwgeom_functions_basic.c b/lwgeom/lwgeom_functions_basic.c index a368ab0ae..d1c0b43a5 100644 --- a/lwgeom/lwgeom_functions_basic.c +++ b/lwgeom/lwgeom_functions_basic.c @@ -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