Fix memory leak when closing out tiles that had all features clipped away

This commit is contained in:
Eric Fischer 2015-07-29 16:45:41 -07:00
parent 39cd5e210e
commit 10e35c4300
2 changed files with 19 additions and 0 deletions

View File

@ -1,3 +1,7 @@
#ifdef MEMTRACE
#include <mcheck.h>
#endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
@ -1043,6 +1047,10 @@ int read_json(int argc, char **argv, char *fname, const char *layername, int max
} }
int main(int argc, char **argv) { int main(int argc, char **argv) {
#ifdef MTRACE
mtrace();
#endif
extern int optind; extern int optind;
extern char *optarg; extern char *optarg;
int i; int i;
@ -1190,5 +1198,10 @@ int main(int argc, char **argv) {
ret = read_json(argc - optind, argv + optind, name ? name : outdir, layer, maxzoom, minzoom, outdb, &exclude, &include, exclude_all, droprate, buffer, tmpdir, gamma, prevent); ret = read_json(argc - optind, argv + optind, name ? name : outdir, layer, maxzoom, minzoom, outdb, &exclude, &include, exclude_all, droprate, buffer, tmpdir, gamma, prevent);
mbtiles_close(outdb, argv); mbtiles_close(outdb, argv);
#ifdef MTRACE
muntrace();
#endif
return ret; return ret;
} }

View File

@ -780,6 +780,12 @@ long long write_tile(char **geoms, char *metabase, char *stringpool, unsigned *f
return count; return count;
} }
} else { } else {
int i;
for (i = 0; i < nlayers; i++) {
pool_free(&keys1[i]);
pool_free(&values1[i]);
}
return count; return count;
} }
} }