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

Raul raul at rmr.ninja
Fri Sep 7 03:57:24 PDT 2018


Author: algunenano
Date: 2018-09-07 03:57:23 -0700 (Fri, 07 Sep 2018)
New Revision: 16721

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

References #4172


Modified: branches/2.5/NEWS
===================================================================
--- branches/2.5/NEWS	2018-09-06 22:36:47 UTC (rev 16720)
+++ branches/2.5/NEWS	2018-09-07 10:57:23 UTC (rev 16721)
@@ -4,6 +4,7 @@
   - #4162, ST_DWithin documentation examples for storing geometry and
     radius in table (Darafei Praliaskouski, github user Boscop).
   - #4163, MVT: Fix resource leak when the first geometry is NULL (Raúl Marín)
+  - #4172, Fix memory leak in lwgeom_offsetcurve (Raúl Marín)
 
 PostGIS 2.5.0rc1
 2018/08/19

Modified: branches/2.5/liblwgeom/lwgeom_geos.c
===================================================================
--- branches/2.5/liblwgeom/lwgeom_geos.c	2018-09-06 22:36:47 UTC (rev 16720)
+++ branches/2.5/liblwgeom/lwgeom_geos.c	2018-09-07 10:57:23 UTC (rev 16721)
@@ -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