From 502061f0db9013be12c5d88cca70e60ea4798003 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bj=C3=B6rn=20Harrtell?= Date: Fri, 28 Apr 2017 16:16:04 +0000 Subject: [PATCH] Make copy of string that will be deallocated and remove unused code git-svn-id: http://svn.osgeo.org/postgis/trunk@15376 b70326c6-7e19-0410-871a-916f4a2858ee --- postgis/geobuf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/postgis/geobuf.c b/postgis/geobuf.c index 5970936e4..ddecf5975 100644 --- a/postgis/geobuf.c +++ b/postgis/geobuf.c @@ -57,7 +57,9 @@ static void encode_keys(struct geobuf_agg_context *ctx) uint32_t i, k = 0; bool geom_name_found = false; for (i = 0; i < natts; i++) { - char *key = tupdesc->attrs[i]->attname.data; + char *tkey = tupdesc->attrs[i]->attname.data; + char *key = palloc(sizeof(*tkey)); + strcpy(key, tkey); if (strcmp(key, ctx->geom_name) == 0) { ctx->geom_index = i; geom_name_found = true; @@ -96,7 +98,7 @@ static void encode_properties(struct geobuf_agg_context *ctx, for (i = 0; i < natts; i++) { Data__Value *value; - char *type, *string_value, *key; + char *type, *string_value; Datum datum; bool isnull; @@ -104,8 +106,6 @@ static void encode_properties(struct geobuf_agg_context *ctx, continue; k++; - key = tupdesc->attrs[i]->attname.data; - value = palloc (sizeof (*value)); data__value__init(value); -- 2.50.1