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