summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@netsurf-browser.org>2010-04-08 13:39:07 +0000
committerDaniel Silverstone <dsilvers@netsurf-browser.org>2010-04-08 13:39:07 +0000
commit2b8adb0c8af3c9e49cfb90be769269359b045a00 (patch)
treed6a2618f47128df557de015f1892e6abff738564 /content
parent8f1dec6f1d213262d33e3a7de3d68ee364102137 (diff)
downloadnetsurf-2b8adb0c8af3c9e49cfb90be769269359b045a00.tar.gz
netsurf-2b8adb0c8af3c9e49cfb90be769269359b045a00.tar.bz2
Move the removal of the retrieval context to prevent a re-entrancy race causing double-release of llcache handles
svn path=/trunk/netsurf/; revision=10307
Diffstat (limited to 'content')
-rw-r--r--content/hlcache.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/content/hlcache.c b/content/hlcache.c
index c78a91599..944022b4a 100644
--- a/content/hlcache.c
+++ b/content/hlcache.c
@@ -273,12 +273,17 @@ nserror hlcache_llcache_callback(llcache_handle *handle,
case LLCACHE_EVENT_HAD_HEADERS:
{
content_type type;
-
+
+ /* Unlink the context to prevent recursion */
+ RING_REMOVE(hlcache_retrieval_ctx_ring, ctx);
+
if (hlcache_type_is_acceptable(handle,
ctx->accepted_types, &type)) {
error = hlcache_find_content(ctx);
- if (error != NSERROR_OK)
+ if (error != NSERROR_OK) {
+ free(ctx);
return error;
+ }
} else if (type == CONTENT_OTHER &&
ctx->flags & HLCACHE_RETRIEVE_MAY_DOWNLOAD) {
/* Unknown type, and we can download, so convert */
@@ -310,7 +315,6 @@ nserror hlcache_llcache_callback(llcache_handle *handle,
}
/* No longer require retrieval context */
- RING_REMOVE(hlcache_retrieval_ctx_ring, ctx);
free(ctx);
}
break;