From c5962cc957c0388ec404e69cfc00042683a3e131 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Mon, 3 May 2010 15:59:16 +0000 Subject: [PATCH] ST_MakeValid: don't choke on MULTILINESTRING containing invalid LINESTRING elements git-svn-id: http://svn.osgeo.org/postgis/trunk@5601 b70326c6-7e19-0410-871a-916f4a2858ee --- postgis/lwgeom_geos_clean.c | 22 ++++++++++++++++++---- regress/clean.sql | 1 + regress/clean_expected | 1 + 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/postgis/lwgeom_geos_clean.c b/postgis/lwgeom_geos_clean.c index f7796fbb1..982fa9c5b 100644 --- a/postgis/lwgeom_geos_clean.c +++ b/postgis/lwgeom_geos_clean.c @@ -640,14 +640,15 @@ LWGEOM_GEOS_makeValidMultiLine(const GEOSGeometry* gin) GEOSGeometry* mline_out=0; GEOSGeometry* mpoint_out=0; GEOSGeometry* gout; - uint32 nlines; + uint32 nlines, nlines_alloc; uint32 npoints=0; - uint32 ngeoms=0; - uint32 i; + uint32 ngeoms=0, nsubgeoms; + uint32 i, j; ngeoms = GEOSGetNumGeometries(gin); - lines = lwalloc(sizeof(GEOSGeometry*)*ngeoms); + nlines_alloc = ngeoms; + lines = lwalloc(sizeof(GEOSGeometry*)*nlines_alloc); points = lwalloc(sizeof(GEOSGeometry*)*ngeoms); for (i=0; i