1
0
forked from GitHub/gf-core

fix memory leak in the pgf-parse tool

This commit is contained in:
kr.angelov
2014-10-24 08:42:32 +00:00
parent 5cae930723
commit 550c747941

View File

@@ -79,6 +79,12 @@ int main(int argc, char* argv[]) {
// XXX: This currently reads stdin directly, so it doesn't support
// encodings properly. TODO: use a locale reader for input
for (int ctr = 0; true; ctr++) {
// We release the last results
if (ppool != NULL) {
gu_pool_free(ppool);
ppool = NULL;
}
/* fprintf(stdout, "> "); */
/* fflush(stdout); */
char buf[4096];
@@ -97,12 +103,6 @@ int main(int argc, char* argv[]) {
continue;
}
// We release the last results
if (ppool != NULL) {
gu_pool_free(ppool);
ppool = NULL;
}
// We create a temporary pool for translating a single
// sentence, so our memory usage doesn't increase over time.
ppool = gu_new_pool();