From 20118e7d06a84ad419b7168a7facb938c58b6302 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bj=C3=B6rn=20Harrtell?= Date: Fri, 28 Apr 2017 17:27:48 +0000 Subject: [PATCH] Fix wrong char * allocation size git-svn-id: http://svn.osgeo.org/postgis/trunk@15377 b70326c6-7e19-0410-871a-916f4a2858ee --- postgis/geobuf.c | 2 +- postgis/mvt.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/postgis/geobuf.c b/postgis/geobuf.c index ddecf5975..6c5ca1f7c 100644 --- a/postgis/geobuf.c +++ b/postgis/geobuf.c @@ -58,7 +58,7 @@ static void encode_keys(struct geobuf_agg_context *ctx) bool geom_name_found = false; for (i = 0; i < natts; i++) { char *tkey = tupdesc->attrs[i]->attname.data; - char *key = palloc(sizeof(*tkey)); + char *key = palloc(strlen(tkey) + 1); strcpy(key, tkey); if (strcmp(key, ctx->geom_name) == 0) { ctx->geom_index = i; diff --git a/postgis/mvt.c b/postgis/mvt.c index b4da299f4..a2e039ff6 100644 --- a/postgis/mvt.c +++ b/postgis/mvt.c @@ -275,7 +275,7 @@ static void encode_keys(struct mvt_agg_context *ctx) bool geom_name_found = false; for (i = 0; i < natts; i++) { char *tkey = tupdesc->attrs[i]->attname.data; - char *key = palloc(sizeof(*tkey)); + char *key = palloc(strlen(tkey) + 1); strcpy(key, tkey); if (strcmp(key, ctx->geom_name) == 0) { ctx->geom_index = i; -- 2.50.1