From 88207c0b17a44e2cd1567919aa1efd499ae79d87 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Sat, 21 Jul 2012 20:10:44 +0100 Subject: Unref the node where appropriate, so we don't have it left behind --- render/html.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/render/html.c b/render/html.c index 8dcd7a84c..97d1750cf 100644 --- a/render/html.c +++ b/render/html.c @@ -187,6 +187,7 @@ static void html_box_convert_done(html_content *c, bool success) msg_data.error = messages_get("NoMemory"); content_broadcast(&c->base, CONTENT_MSG_ERROR, msg_data); content_set_error(&c->base); + dom_node_unref(html); return; } /*imagemap_dump(c);*/ @@ -201,6 +202,7 @@ static void html_box_convert_done(html_content *c, bool success) content_set_done(&c->base); html_set_status(c, ""); + dom_node_unref(html); } /** @@ -296,6 +298,7 @@ void html_finish_conversion(html_content *c) content_set_error(&c->base); return; } + dom_node_unref(html); } @@ -1998,6 +2001,7 @@ static bool html_convert(struct content *c) LOG(("root element not html")); msg_data.error = messages_get("ParsingFail"); content_broadcast(c, CONTENT_MSG_ERROR, msg_data); + dom_node_unref(html); return false; } dom_string_unref(node_name); @@ -2046,12 +2050,17 @@ static bool html_convert(struct content *c) if (html_head(htmlc, head) == false) { msg_data.error = messages_get("NoMemory"); content_broadcast(c, CONTENT_MSG_ERROR, msg_data); + dom_node_unref(html); + dom_node_unref(head); return false; } /* handle meta refresh */ - if (html_meta_refresh(htmlc, head) == false) + if (html_meta_refresh(htmlc, head) == false) { + dom_node_unref(html); + dom_node_unref(head); return false; + } } /* Retrieve forms from parser */ @@ -2074,6 +2083,8 @@ static bool html_convert(struct content *c) if (res != URL_FUNC_OK) { msg_data.error = messages_get("NoMemory"); content_broadcast(c, CONTENT_MSG_ERROR, msg_data); + dom_node_unref(html); + dom_node_unref(head); return false; } @@ -2087,15 +2098,21 @@ static bool html_convert(struct content *c) msg_data.error = messages_get("NoMemory"); content_broadcast(c, CONTENT_MSG_ERROR, msg_data); + dom_node_unref(html); + dom_node_unref(head); return false; } } } + dom_node_unref(head); /* get stylesheets */ - if (html_find_stylesheets(htmlc, html) == false) + if (html_find_stylesheets(htmlc, html) == false) { + dom_node_unref(html); return false; + } + dom_node_unref(html); return true; } -- cgit v1.2.3