summaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@gmail.com>2014-10-24 08:42:32 +0000
committerkr.angelov <kr.angelov@gmail.com>2014-10-24 08:42:32 +0000
commit550c74794129890397e98a14560cd072f21a78b8 (patch)
treef9dcab7346ea28347f6f15618ccb3935e7ef003c /src/runtime
parent5cae9307237995a8028e3118c3a14c3b83a230c1 (diff)
fix memory leak in the pgf-parse tool
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/c/utils/pgf-parse.c12
1 files 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();