changeset 1144:bafb6a5a52a9

A litter more cautious about NULL applications; plug a memory leak in some Postgres functions
author Adam Chlipala <adamc@hcoop.net>
date Sun, 31 Jan 2010 15:28:50 -0500
parents a9ba22d551f0
children 6249df767d4c
files src/c/urweb.c src/postgres.sml
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/c/urweb.c	Sun Jan 31 07:44:49 2010 -0500
+++ b/src/c/urweb.c	Sun Jan 31 15:28:50 2010 -0500
@@ -2884,7 +2884,7 @@
     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) {
--- a/src/postgres.sml	Sun Jan 31 07:44:49 2010 -0500
+++ b/src/postgres.sml	Sun Jan 31 15:28:50 2010 -0500
@@ -411,6 +411,8 @@
               newline],
          string "}",
          newline,
+         string "PQclear(res);",
+         newline,
          string "return 0;",
          newline,
          string "}",
@@ -434,6 +436,8 @@
               newline],
          string "}",
          newline,
+         string "PQclear(res);",
+         newline,
          string "return 0;",
          newline,
          string "}",
@@ -457,6 +461,8 @@
               newline],
          string "}",
          newline,
+         string "PQclear(res);",
+         newline,
          string "return 0;",
          newline,
          string "}",