From: Christian Dywan Date: Mon, 10 Oct 2011 19:55:12 +0000 (+0200) Subject: Use goto to not leak parts in midori_view_update_icon X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d013cc85a9cac7fd8922b687b0cd6fb6822fbce6;p=midori Use goto to not leak parts in midori_view_update_icon --- diff --git a/midori/midori-view.c b/midori/midori-view.c index 66db05eb..55782709 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -756,27 +756,29 @@ midori_view_update_icon (MidoriView* view, if (!((parts = g_strsplit (view->mime_type, "/", 2)) && (*parts && parts[1]))) { - g_strfreev (parts); /* This is a hack to have a Find icon in the location while the blank page has a File icon. */ icon = gtk_widget_render_icon (GTK_WIDGET (view), GTK_STOCK_FIND, GTK_ICON_SIZE_MENU, NULL); midori_view_apply_icon (view, icon, GTK_STOCK_FILE); - return; + goto free_parts; } if (midori_view_mime_icon (view, theme, "%s-%s", *parts, parts[1])) - return; + goto free_parts; if (midori_view_mime_icon (view, theme, "gnome-mime-%s-%s", *parts, parts[1])) - return; + goto free_parts; if (midori_view_mime_icon (view, theme, "%s-x-generic", *parts, NULL)) - return; + goto free_parts; if (midori_view_mime_icon (view, theme, "gnome-mime-%s-x-generic", *parts, NULL)) - return; + goto free_parts; icon = gtk_widget_render_icon (GTK_WIDGET (view), GTK_STOCK_FILE, GTK_ICON_SIZE_MENU, NULL); midori_view_apply_icon (view, icon, NULL); + +free_parts: + g_strfreev (parts); } typedef struct