summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2010-01-31 15:28:50 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2010-01-31 15:28:50 -0500
commit771ec67a7691b5732b4915c6bbaefe9b21f35362 (patch)
tree51b1935e4a473df79627ff6088a3e30b08fe60e8 /src
parentab0611f75f34be35567af66528ca78c3cf48a77a (diff)
A litter more cautious about NULL applications; plug a memory leak in some Postgres functions
Diffstat (limited to 'src')
-rw-r--r--src/c/urweb.c2
-rw-r--r--src/postgres.sml6
2 files changed, 7 insertions, 1 deletions
diff --git a/src/c/urweb.c b/src/c/urweb.c
index 0ec741cc..ad0d33d9 100644
--- a/src/c/urweb.c
+++ b/src/c/urweb.c
@@ -2884,7 +2884,7 @@ int uw_rollback(uw_context ctx) {
if (ctx->transactionals[i].free)
ctx->transactionals[i].free(ctx->transactionals[i].data);
- return ctx->app->db_rollback(ctx);
+ return ctx->app ? ctx->app->db_rollback(ctx) : 0;
}
void uw_commit(uw_context ctx) {
diff --git a/src/postgres.sml b/src/postgres.sml
index 59fa3330..a3f33db1 100644
--- a/src/postgres.sml
+++ b/src/postgres.sml
@@ -411,6 +411,8 @@ fun init {dbstring, prepared = ss, tables, views, sequences} =
newline],
string "}",
newline,
+ string "PQclear(res);",
+ newline,
string "return 0;",
newline,
string "}",
@@ -434,6 +436,8 @@ fun init {dbstring, prepared = ss, tables, views, sequences} =
newline],
string "}",
newline,
+ string "PQclear(res);",
+ newline,
string "return 0;",
newline,
string "}",
@@ -457,6 +461,8 @@ fun init {dbstring, prepared = ss, tables, views, sequences} =
newline],
string "}",
newline,
+ string "PQclear(res);",
+ newline,
string "return 0;",
newline,
string "}",