From 8a49da03f08a4b392544304a13fe9da590faa28e Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Sun, 28 Mar 2010 14:39:52 +0000 Subject: Ensure we honour html_fetch_object's API properly regarding NOMEM behaviour svn path=/trunk/netsurf/; revision=10181 --- render/html.c | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) (limited to 'render') diff --git a/render/html.c b/render/html.c index d63c68764..5838055e5 100644 --- a/render/html.c +++ b/render/html.c @@ -1272,25 +1272,24 @@ bool html_fetch_object(struct content *c, const char *url, struct box *box, /* No longer need normalized url */ free(url2); - if (error != NSERROR_OK) - return false; - - /* add to object list */ - object = talloc_realloc(c, c->data.html.object, - struct content_html_object, i + 1); - if (object == NULL) { - hlcache_handle_release(c_fetch); - return false; - } - c->data.html.object = object; - c->data.html.object[i].box = box; - c->data.html.object[i].permitted_types = permitted_types; - c->data.html.object[i].background = background; - c->data.html.object[i].content = c_fetch; - c->data.html.object_count++; - c->active++; - - return true; + if (error == NSERROR_OK) { + /* add to object list */ + object = talloc_realloc(c, c->data.html.object, + struct content_html_object, i + 1); + if (object == NULL) { + hlcache_handle_release(c_fetch); + return false; + } + c->data.html.object = object; + c->data.html.object[i].box = box; + c->data.html.object[i].permitted_types = permitted_types; + c->data.html.object[i].background = background; + c->data.html.object[i].content = c_fetch; + c->data.html.object_count++; + c->active++; + } + + return error != NSERROR_NOMEM; } -- cgit v1.2.3