[postgis-tickets] r16015 - Fix memory leak when lwgeom_simplify returns an empty geom

Paul Ramsey pramsey at cleverelephant.ca
Wed Oct 18 12:35:50 PDT 2017


Author: pramsey
Date: 2017-10-18 12:35:50 -0700 (Wed, 18 Oct 2017)
New Revision: 16015

Modified:
   trunk/liblwgeom/lwgeom.c
Log:
Fix memory leak when lwgeom_simplify returns an empty geom
>From Ra?\195?\186l Mar?\195?\173n Rodr?\195?\173guez
Closes #3908


Modified: trunk/liblwgeom/lwgeom.c
===================================================================
--- trunk/liblwgeom/lwgeom.c	2017-10-18 19:28:28 UTC (rev 16014)
+++ trunk/liblwgeom/lwgeom.c	2017-10-18 19:35:50 UTC (rev 16015)
@@ -1824,7 +1824,11 @@
 {
 	LWGEOM *lwgeom_out = lwgeom_clone_deep(igeom);
 	lwgeom_simplify_in_place(lwgeom_out, dist, preserve_collapsed);
-	if (lwgeom_is_empty(lwgeom_out)) return NULL;
+	if (lwgeom_is_empty(lwgeom_out))
+	{
+		lwgeom_free(lwgeom_out);
+		return NULL;
+	}
 	return lwgeom_out;
 }
 



More information about the postgis-tickets mailing list