changeset 1084:8e240c007442

Don't relify in bigLibs; fix some memory bugs in transactionals
author Adam Chlipala <adamc@hcoop.net>
date Wed, 23 Dec 2009 14:27:12 -0500
parents 2eb585274501
children ae885ad70d83
files src/c/urweb.c src/compiler.sml
diffstat 2 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/c/urweb.c	Wed Dec 23 12:25:34 2009 -0500
+++ b/src/c/urweb.c	Wed Dec 23 14:27:12 2009 -0500
@@ -2851,7 +2851,8 @@
       ctx->transactionals[i].rollback(ctx->transactionals[i].data);
 
   for (i = 0; i < ctx->used_transactionals; ++i)
-    ctx->transactionals[i].free(ctx->transactionals[i].data);
+    if (ctx->transactionals[i].free)
+      ctx->transactionals[i].free(ctx->transactionals[i].data);
 
   return uw_db_rollback(ctx);
 }
@@ -2859,7 +2860,7 @@
 void uw_register_transactional(uw_context ctx, void *data, uw_callback commit, uw_callback rollback,
                                uw_callback free) {
   if (ctx->used_transactionals >= ctx->n_transactionals) {
-    ctx->transactionals = realloc(ctx->transactionals, ctx->used_transactionals+1);
+    ctx->transactionals = realloc(ctx->transactionals, sizeof(transactional) * (ctx->used_transactionals+1));
     ++ctx->n_transactionals;
   }
 
--- a/src/compiler.sml	Wed Dec 23 12:25:34 2009 -0500
+++ b/src/compiler.sml	Wed Dec 23 14:27:12 2009 -0500
@@ -561,7 +561,7 @@
                               | "library" => if accLibs then
                                                  libs := pu (relify arg) :: !libs
                                              else
-                                                 bigLibs := relify arg :: !bigLibs
+                                                 bigLibs := arg :: !bigLibs
                               | "path" =>
                                 (case String.fields (fn ch => ch = #"=") arg of
                                      [n, v] => pathmap := M.insert (!pathmap, n, v)