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

Raul raul at rmr.ninja
Wed Aug 29 02:17:33 PDT 2018


Author: algunenano
Date: 2018-08-29 02:17:33 -0700 (Wed, 29 Aug 2018)
New Revision: 16708

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

References #4163


Modified: branches/2.4/NEWS
===================================================================
--- branches/2.4/NEWS	2018-08-28 07:51:44 UTC (rev 16707)
+++ branches/2.4/NEWS	2018-08-29 09:17:33 UTC (rev 16708)
@@ -17,6 +17,7 @@
   - #4093, Inconsistent results from qsort callback (yugr)
   - #4081, Geography DWithin() issues for certain cases (Paul Ramsey)
   - #4105, Parallel build of tarball (Bas Couwenberg)
+  - #4163, MVT: Fix resource leak when the first geometry is NULL (Raúl Marín)
 
 
 PostGIS 2.4.4

Modified: branches/2.4/postgis/mvt.c
===================================================================
--- branches/2.4/postgis/mvt.c	2018-08-28 07:51:44 UTC (rev 16707)
+++ branches/2.4/postgis/mvt.c	2018-08-29 09:17:33 UTC (rev 16708)
@@ -786,6 +786,7 @@
 	ctx->bool_values_hash = NULL;
 	ctx->values_hash_i = 0;
 	ctx->keys_hash_i = 0;
+	ctx->geom_index = UINT32_MAX;
 
 	layer = palloc(sizeof(*layer));
 	vector_tile__tile__layer__init(layer);
@@ -824,7 +825,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