]> granicus.if.org Git - postgis/commitdiff
MVT: Fix resource leak when the first geometry is NULL
authorRaúl Marín Rodríguez <rmrodriguez@carto.com>
Wed, 29 Aug 2018 09:28:08 +0000 (09:28 +0000)
committerRaúl Marín Rodríguez <rmrodriguez@carto.com>
Wed, 29 Aug 2018 09:28:08 +0000 (09:28 +0000)
References #4163

git-svn-id: http://svn.osgeo.org/postgis/branches/2.5@16709 b70326c6-7e19-0410-871a-916f4a2858ee

NEWS
postgis/mvt.c

diff --git a/NEWS b/NEWS
index c54d065ece58a8f163868710e2341f79a1cc2dba..50e43e1b8862243d908465c443f9b9bdc9962272 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ PostGIS 2.5.0rc2
 New since PostGIS 2.5.0rc1
   - #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
index 9248563063ce00d7586ccf72d116a4a8fd22aef5..cdca7e68d1eda1c694a6dd73a4e8fe11b7d363fa 100644 (file)
@@ -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);