diff options
Diffstat (limited to 'content/hlcache.c')
-rw-r--r-- | content/hlcache.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/content/hlcache.c b/content/hlcache.c index 388c59a94..85567f5a4 100644 --- a/content/hlcache.c +++ b/content/hlcache.c @@ -631,8 +631,9 @@ nserror hlcache_handle_retrieve(nsurl *url, uint32_t flags, assert(cb != NULL); ctx = calloc(1, sizeof(hlcache_retrieval_ctx)); - if (ctx == NULL) + if (ctx == NULL) { return NSERROR_NOMEM; + } ctx->handle = calloc(1, sizeof(hlcache_handle)); if (ctx->handle == NULL) { @@ -662,17 +663,17 @@ nserror hlcache_handle_retrieve(nsurl *url, uint32_t flags, hlcache_llcache_callback, ctx, &ctx->llcache); if (error != NSERROR_OK) { + /* error retriving handle so free context and return error */ free((char *) ctx->child.charset); free(ctx->handle); free(ctx); - return error; - } - - RING_INSERT(hlcache->retrieval_ctx_ring, ctx); - - *result = ctx->handle; + } else { + /* successfuly started fetch so add new context to list */ + RING_INSERT(hlcache->retrieval_ctx_ring, ctx); - return NSERROR_OK; + *result = ctx->handle; + } + return error; } /* See hlcache.h for documentation */ |