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
commitc6ed3035896b5cca544ef9bf245cd76019783b1f (patch)
treeaa4fda4e4f7a4a5d0f7920c3e3653d17667dfee3 /src/cjr_print.sml
parent6dbd6e0786f8ab1b5b35883dca6695cf58272b5b (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);",