comparison src/lru_cache.sml @ 2297:6d56080f495c

Fix a read-after-free bug using a timestamp check
author Adam Chlipala <adam@chlipala.net>
date Thu, 19 Nov 2015 13:18:58 -0500
parents 5104e480b3e3
children 6e580e319077
comparison
equal deleted inserted replaced
2296:5104e480b3e3 2297:6d56080f495c
134 string ("static uw_unit uw_Sqlcache_store" ^ i), 134 string ("static uw_unit uw_Sqlcache_store" ^ i),
135 string ("(uw_context ctx, uw_Basis_string s" ^ typedArgs ^ ") {"), 135 string ("(uw_context ctx, uw_Basis_string s" ^ typedArgs ^ ") {"),
136 newline, 136 newline,
137 string (" char *ks[] = {" ^ revArgs ^ "};"), 137 string (" char *ks[] = {" ^ revArgs ^ "};"),
138 newline, 138 newline,
139 string (" uw_Sqlcache_Value *v = calloc(1, sizeof(uw_Sqlcache_Value));"), 139 string (" uw_Sqlcache_Value *v = malloc(sizeof(uw_Sqlcache_Value));"),
140 newline, 140 newline,
141 string " v->result = strdup(s);", 141 string " v->result = strdup(s);",
142 newline, 142 newline,
143 string " v->output = uw_recordingRead(ctx);", 143 string " v->output = uw_recordingRead(ctx);",
144 newline,
145 string " v->timeValid = 0;",
146 newline, 144 newline,
147 (*string (" puts(\"SQLCACHE: stored " ^ i ^ ".\");"), 145 (*string (" puts(\"SQLCACHE: stored " ^ i ^ ".\");"),
148 newline,*) 146 newline,*)
149 string (" uw_Sqlcache_store(ctx, cache" ^ i ^ ", ks, v);"), 147 string (" uw_Sqlcache_store(ctx, cache" ^ i ^ ", ks, v);"),
150 newline, 148 newline,