From: Raúl Marín Rodríguez Date: Wed, 29 Aug 2018 09:36:48 +0000 (+0000) Subject: MVT: Fix resource leak when the first geometry is NULL X-Git-Tag: 3.0.0alpha1~472 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ae6f8ec390c1c4f045ef7ae70d7aa138ff64db73;p=postgis MVT: Fix resource leak when the first geometry is NULL Closes #4163 git-svn-id: http://svn.osgeo.org/postgis/trunk@16710 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/NEWS b/NEWS index d2d549a0a..f15fefe42 100644 --- a/NEWS +++ b/NEWS @@ -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 diff --git a/postgis/mvt.c b/postgis/mvt.c index 924856306..cdca7e68d 100644 --- a/postgis/mvt.c +++ b/postgis/mvt.c @@ -894,6 +894,7 @@ void mvt_agg_init_context(mvt_agg_context *ctx) 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 @@ void mvt_agg_transfn(mvt_agg_context *ctx) 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);