From 099623cd32d30af83043679de14c54c4fd3ef36f Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Mon, 29 Sep 2014 15:59:36 -0700 Subject: [PATCH] Arrays for coalescing can get too big for the stack. --- tile.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tile.cc b/tile.cc index e7b18201..ce09b876 100644 --- a/tile.cc +++ b/tile.cc @@ -511,7 +511,7 @@ long long write_tile(struct index *start, struct index *end, char *metabase, uns } int nfeatures = 0; - struct coalesce features[end - start]; + struct coalesce *features = (struct coalesce *) malloc((end - start) * sizeof(struct coalesce)); struct index *i; for (i = start; i < end; i++) { @@ -642,6 +642,8 @@ long long write_tile(struct index *start, struct index *end, char *metabase, uns free(features[x].meta); } + free(features); + struct pool_val *pv; for (pv = keys.head; pv != NULL; pv = pv->next) { layer->add_keys(pv->s, strlen(pv->s));