From 9276b7567dd32cbfe7f80f0c800b90287be7e2c4 Mon Sep 17 00:00:00 2001 From: "kr.angelov" Date: Fri, 24 Oct 2014 08:42:32 +0000 Subject: [PATCH] fix memory leak in the pgf-parse tool --- src/runtime/c/utils/pgf-parse.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/runtime/c/utils/pgf-parse.c b/src/runtime/c/utils/pgf-parse.c index 991a16361..182ed31b4 100644 --- a/src/runtime/c/utils/pgf-parse.c +++ b/src/runtime/c/utils/pgf-parse.c @@ -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();