From 2468d006757ed81b782cfc8291029b2bb9f7411b Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 5 Sep 2013 13:06:53 +0100 Subject: Check for error as soon as we have return value. --- desktop/hotlist.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'desktop') diff --git a/desktop/hotlist.c b/desktop/hotlist.c index 54ff6f86e..9af1d9732 100644 --- a/desktop/hotlist.c +++ b/desktop/hotlist.c @@ -653,6 +653,10 @@ nserror hotlist_load_directory_cb(dom_node *node, void *ctx) /* Add folder node */ err = hotlist_add_folder_internal(title, current_ctx->rel, current_ctx->relshp, &f); + if (err != NSERROR_OK) { + dom_string_unref(name); + return NSERROR_NOMEM; + } /* Check if folder should be default folder */ error = dom_element_get_attribute(node, corestring_dom_id, &id); @@ -671,11 +675,6 @@ nserror hotlist_load_directory_cb(dom_node *node, void *ctx) current_ctx->rel = rel; current_ctx->relshp = TREE_REL_NEXT_SIBLING; - if (err != NSERROR_OK) { - dom_string_unref(name); - return NSERROR_NOMEM; - } - new_ctx.tree = current_ctx->tree; new_ctx.rel = rel; new_ctx.relshp = TREE_REL_FIRST_CHILD; -- cgit v1.2.3