[postgis-tickets] r16710 - MVT: Fix resource leak when the first geometry is NULL

Raul raul at rmr.ninja
Wed Aug 29 02:36:49 PDT 2018


Author: algunenano
Date: 2018-08-29 02:36:48 -0700 (Wed, 29 Aug 2018)
New Revision: 16710

Modified:
   trunk/NEWS
   trunk/postgis/mvt.c
Log:
MVT: Fix resource leak when the first geometry is NULL

Closes #4163


Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2018-08-29 09:28:08 UTC (rev 16709)
+++ trunk/NEWS	2018-08-29 09:36:48 UTC (rev 16710)
@@ -1,10 +1,11 @@
 PostGIS 3.0.0
 2019/xx/xx
-* Enhancements *
+* Enhancements and fixes *
   - #4153, ST_Segmentize now splits segments proportionally (Darafei
     Praliaskouski).
   - #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)
 
 PostGIS 2.5.0rc1
 2018/08/19

Modified: trunk/postgis/mvt.c
===================================================================
--- trunk/postgis/mvt.c	2018-08-29 09:28:08 UTC (rev 16709)
+++ trunk/postgis/mvt.c	2018-08-29 09:36:48 UTC (rev 16710)
@@ -894,6 +894,7 @@
 	ctx->bool_values_hash = NULL;
 	ctx->values_hash_i = 0;
 	ctx->keys_hash_i = 0;
+	ctx->geom_index = UINT32_MAX;
 
 	memset(&ctx->column_cache, 0, sizeof(ctx->column_cache));
 
@@ -936,7 +937,7 @@
 		POSTGIS_DEBUGF(3, "mvt_agg_transfn new_capacity: %zd", new_capacity);
 	}
 
-	if (layer->n_features == 0)
+	if (ctx->geom_index == UINT32_MAX)
 		parse_column_keys(ctx);
 
 	datum = GetAttributeByNum(ctx->row, ctx->geom_index + 1, &isnull);



More information about the postgis-tickets mailing list