diff options
author | Vincent Sanders <vince@kyllikki.org> | 2015-06-24 10:31:13 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2015-06-24 10:31:13 +0100 |
commit | 73e45ff0246c2624b890bbbec0367eb1c450eec3 (patch) | |
tree | 644cbeeabe43a3b86c82bbbe8b722084c1c8f856 /content/hlcache.c | |
parent | 5bd7606103182a824b530a24a1f4753e04c145ec (diff) | |
download | netsurf-73e45ff0246c2624b890bbbec0367eb1c450eec3.tar.gz netsurf-73e45ff0246c2624b890bbbec0367eb1c450eec3.tar.bz2 |
Fix error reporting from fetch_start
Any fetch start error was being reported as "out of memory" which was
clearly insufficient. Foe example bad urls (reported was file:// with
a missing /) were causing a warn_user with out of memory. This change
now at least causes a "bad url" message.
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 */ |