[postgis-tickets] r16722 - Fix memory leak in lwgeom_offsetcurve

Raul raul at rmr.ninja
Fri Sep 7 03:59:01 PDT 2018


Author: algunenano
Date: 2018-09-07 03:59:01 -0700 (Fri, 07 Sep 2018)
New Revision: 16722

Modified:
   trunk/NEWS
   trunk/liblwgeom/lwgeom_geos.c
Log:
Fix memory leak in lwgeom_offsetcurve

Closes #4172
Closes https://github.com/postgis/postgis/pull/291


Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2018-09-07 10:57:23 UTC (rev 16721)
+++ trunk/NEWS	2018-09-07 10:59:01 UTC (rev 16722)
@@ -7,6 +7,7 @@
     radius in table (Darafei Praliaskouski, github user Boscop).
   - #4163, MVT: Fix resource leak when the first geometry is NULL (Raúl Marín)
   - #4161, MVT: Drop geometries smaller than the resolution (Raúl Marín)
+  - #4172, Fix memory leak in lwgeom_offsetcurve (Raúl Marín)
 
 PostGIS 2.5.0rc1
 2018/08/19

Modified: trunk/liblwgeom/lwgeom_geos.c
===================================================================
--- trunk/liblwgeom/lwgeom_geos.c	2018-09-07 10:57:23 UTC (rev 16721)
+++ trunk/liblwgeom/lwgeom_geos.c	2018-09-07 10:59:01 UTC (rev 16722)
@@ -1389,13 +1389,15 @@
 		}
 
 		if (result)
+		{
+			if (noded) lwgeom_free(noded);
 			return result;
+		}
 		else if (!noded)
 		{
 			noded = lwgeom_node(geom);
 			if (!noded)
 			{
-				lwfree(noded);
 				lwerror("lwgeom_offsetcurve: cannot node input");
 				return NULL;
 			}
@@ -1403,10 +1405,12 @@
 		}
 		else
 		{
+			lwgeom_free(noded);
 			lwerror("lwgeom_offsetcurve: noded geometry cannot be offset");
 			return NULL;
 		}
 	}
+
 	return result;
 }
 



More information about the postgis-tickets mailing list