From: Björn Harrtell Date: Fri, 28 Apr 2017 16:10:21 +0000 (+0000) Subject: Make copy of string that will be deallocated and make bool type clear X-Git-Tag: 2.4.0alpha~117 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0a408109974ba873f129ca2badb3e7f4b89f4ec0;p=postgis Make copy of string that will be deallocated and make bool type clear git-svn-id: http://svn.osgeo.org/postgis/trunk@15375 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/postgis/mvt.c b/postgis/mvt.c index f2a20cfb7..b4da299f4 100644 --- a/postgis/mvt.c +++ b/postgis/mvt.c @@ -73,7 +73,7 @@ struct mvt_kv_sint_value { }; struct mvt_kv_bool_value { - bool bool_value; + protobuf_c_boolean bool_value; uint32_t id; UT_hash_handle hh; }; @@ -274,7 +274,9 @@ static void encode_keys(struct mvt_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 = 1; @@ -428,9 +430,9 @@ static void parse_values(struct mvt_agg_context *ctx) Oid typoid = getBaseType(tupdesc->attrs[i]->atttypid); switch (typoid) { case BOOLOID: - MVT_PARSE_DATUM(bool, mvt_kv_bool_value, + MVT_PARSE_DATUM(protobuf_c_boolean, mvt_kv_bool_value, bool_values_hash, bool_value, - DatumGetBool, sizeof(bool)); + DatumGetBool, sizeof(protobuf_c_boolean)); break; case INT2OID: MVT_PARSE_INT_DATUM(int16_t, DatumGetInt16);