[postgis-tickets] r15377 - Fix wrong char * allocation size
bjorn at wololo.org
bjorn at wololo.org
Fri Apr 28 10:27:49 PDT 2017
Author: bjornharrtell
Date: 2017-04-28 10:27:48 -0700 (Fri, 28 Apr 2017)
New Revision: 15377
Modified:
trunk/postgis/geobuf.c
trunk/postgis/mvt.c
Log:
Fix wrong char * allocation size
Modified: trunk/postgis/geobuf.c
===================================================================
--- trunk/postgis/geobuf.c 2017-04-28 16:16:04 UTC (rev 15376)
+++ trunk/postgis/geobuf.c 2017-04-28 17:27:48 UTC (rev 15377)
@@ -58,7 +58,7 @@
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;
Modified: trunk/postgis/mvt.c
===================================================================
--- trunk/postgis/mvt.c 2017-04-28 16:16:04 UTC (rev 15376)
+++ trunk/postgis/mvt.c 2017-04-28 17:27:48 UTC (rev 15377)
@@ -275,7 +275,7 @@
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;
More information about the postgis-tickets
mailing list