summaryrefslogtreecommitdiff
path: root/content/hlcache.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2010-04-11 16:23:45 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2010-04-11 16:23:45 +0000
commitad89d5b263ca86c5c55366fc7412cfc1529b13c3 (patch)
tree24e4aada6f3fff76663c88cd9cabd2c5c1e25546 /content/hlcache.c
parenta364888ed220376e2cb0e783bc099860ee94032c (diff)
downloadnetsurf-ad89d5b263ca86c5c55366fc7412cfc1529b13c3.tar.gz
netsurf-ad89d5b263ca86c5c55366fc7412cfc1529b13c3.tar.bz2
Copy child charset, if any
svn path=/trunk/netsurf/; revision=10359
Diffstat (limited to 'content/hlcache.c')
-rw-r--r--content/hlcache.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/content/hlcache.c b/content/hlcache.c
index 69b3dff95..baadf0c3c 100644
--- a/content/hlcache.c
+++ b/content/hlcache.c
@@ -109,8 +109,14 @@ nserror hlcache_handle_retrieve(const char *url, uint32_t flags,
}
if (child != NULL) {
- /** \todo Is the charset guaranteed to exist during fetch? */
- ctx->child.charset = child->charset;
+ if (child->charset != NULL) {
+ ctx->child.charset = strdup(child->charset);
+ if (ctx->child.charset == NULL) {
+ free(ctx->handle);
+ free(ctx);
+ return NSERROR_NOMEM;
+ }
+ }
ctx->child.quirks = child->quirks;
}
@@ -124,6 +130,7 @@ nserror hlcache_handle_retrieve(const char *url, uint32_t flags,
hlcache_llcache_callback, ctx,
&ctx->llcache);
if (error != NSERROR_OK) {
+ free((char *) ctx->child.charset);
free(ctx->handle);
free(ctx);
return error;
@@ -147,15 +154,18 @@ nserror hlcache_handle_release(hlcache_handle *handle)
hlcache_retrieval_ctx_ring,
ictx) {
if (ictx->handle == handle) {
- /* This is the nascent context for us, so abort the fetch */
+ /* This is the nascent context for us,
+ * so abort the fetch */
llcache_handle_abort(ictx->llcache);
llcache_handle_release(ictx->llcache);
/* Remove us from the ring */
RING_REMOVE(hlcache_retrieval_ctx_ring, ictx);
/* Throw us away */
+ free((char *) ictx->child.charset);
free(ictx);
/* And stop */
- RING_ITERATE_STOP(hlcache_retrieval_ctx_ring, ictx);
+ RING_ITERATE_STOP(hlcache_retrieval_ctx_ring,
+ ictx);
}
} RING_ITERATE_END(hlcache_retrieval_ctx_ring, ictx);
}
@@ -195,15 +205,18 @@ nserror hlcache_handle_abort(hlcache_handle *handle)
hlcache_retrieval_ctx_ring,
ictx) {
if (ictx->handle == handle) {
- /* This is the nascent context for us, so abort the fetch */
+ /* This is the nascent context for us,
+ * so abort the fetch */
llcache_handle_abort(ictx->llcache);
llcache_handle_release(ictx->llcache);
/* Remove us from the ring */
RING_REMOVE(hlcache_retrieval_ctx_ring, ictx);
/* Throw us away */
+ free((char *) ictx->child.charset);
free(ictx);
/* And stop */
- RING_ITERATE_STOP(hlcache_retrieval_ctx_ring, ictx);
+ RING_ITERATE_STOP(hlcache_retrieval_ctx_ring,
+ ictx);
}
} RING_ITERATE_END(hlcache_retrieval_ctx_ring, ictx);
@@ -281,6 +294,7 @@ nserror hlcache_llcache_callback(llcache_handle *handle,
ctx->accepted_types, &type)) {
error = hlcache_find_content(ctx);
if (error != NSERROR_OK) {
+ free((char *) ctx->child.charset);
free(ctx);
return error;
}
@@ -315,6 +329,7 @@ nserror hlcache_llcache_callback(llcache_handle *handle,
}
/* No longer require retrieval context */
+ free((char *) ctx->child.charset);
free(ctx);
}
break;