summaryrefslogtreecommitdiff
path: root/src/lru_cache.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2015-11-19 13:18:58 -0500
committerGravatar Adam Chlipala <adam@chlipala.net>2015-11-19 13:18:58 -0500
commit30dd885d1fc3013be0e3c2a45b2e0117f684f40a (patch)
tree6a4c70334b35d4b065a6b8fa81842fb1cc45adcb /src/lru_cache.sml
parent7a49a90f8b092e1c2e58d3e754578cff3bf06b18 (diff)
Fix a read-after-free bug using a timestamp check
Diffstat (limited to 'src/lru_cache.sml')
-rw-r--r--src/lru_cache.sml4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/lru_cache.sml b/src/lru_cache.sml
index 5c05b261..851b4ccb 100644
--- a/src/lru_cache.sml
+++ b/src/lru_cache.sml
@@ -136,14 +136,12 @@ fun setupQuery {index, params} =
newline,
string (" char *ks[] = {" ^ revArgs ^ "};"),
newline,
- string (" uw_Sqlcache_Value *v = calloc(1, sizeof(uw_Sqlcache_Value));"),
+ string (" uw_Sqlcache_Value *v = malloc(sizeof(uw_Sqlcache_Value));"),
newline,
string " v->result = strdup(s);",
newline,
string " v->output = uw_recordingRead(ctx);",
newline,
- string " v->timeValid = 0;",
- newline,
(*string (" puts(\"SQLCACHE: stored " ^ i ^ ".\");"),
newline,*)
string (" uw_Sqlcache_store(ctx, cache" ^ i ^ ", ks, v);"),