summaryrefslogtreecommitdiff
path: root/src/cjr_print.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-10-24 17:30:07 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-10-24 17:30:07 -0400
commit6e9d4b27c527465c6df34d35e4d85dc3162db7c9 (patch)
treeaa4fda4e4f7a4a5d0f7920c3e3653d17667dfee3 /src/cjr_print.sml
parent4f82b8197a0e0b520882c0173f321bd948fc7b50 (diff)
Properly freeing libpq results on errors
Diffstat (limited to 'src/cjr_print.sml')
-rw-r--r--src/cjr_print.sml4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cjr_print.sml b/src/cjr_print.sml
index 7d74376e..26f6149e 100644
--- a/src/cjr_print.sml
+++ b/src/cjr_print.sml
@@ -850,6 +850,8 @@ fun p_exp' par env (e, loc) =
string "uw_end_region(ctx);",
newline,
+ string "uw_push_cleanup(ctx, (void (*)(void *))PQclear, res);",
+ newline,
string "n = PQntuples(res);",
newline,
string "for (i = 0; i < n; ++i) {",
@@ -906,7 +908,7 @@ fun p_exp' par env (e, loc) =
string "}",
newline,
newline,
- string "PQclear(res);",
+ string "uw_pop_cleanup(ctx);",
newline,
if wontLeakAnything then
box [string "uw_end_region(ctx);",