Use goto to not leak parts in midori_view_update_icon
This commit is contained in:
parent
3071da6711
commit
d013cc85a9
1 changed files with 8 additions and 6 deletions
|
@ -756,27 +756,29 @@ midori_view_update_icon (MidoriView* view,
|
||||||
|
|
||||||
if (!((parts = g_strsplit (view->mime_type, "/", 2)) && (*parts && parts[1])))
|
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
|
/* This is a hack to have a Find icon in the location while the
|
||||||
blank page has a File icon. */
|
blank page has a File icon. */
|
||||||
icon = gtk_widget_render_icon (GTK_WIDGET (view),
|
icon = gtk_widget_render_icon (GTK_WIDGET (view),
|
||||||
GTK_STOCK_FIND, GTK_ICON_SIZE_MENU, NULL);
|
GTK_STOCK_FIND, GTK_ICON_SIZE_MENU, NULL);
|
||||||
midori_view_apply_icon (view, icon, GTK_STOCK_FILE);
|
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]))
|
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]))
|
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))
|
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))
|
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),
|
icon = gtk_widget_render_icon (GTK_WIDGET (view),
|
||||||
GTK_STOCK_FILE, GTK_ICON_SIZE_MENU, NULL);
|
GTK_STOCK_FILE, GTK_ICON_SIZE_MENU, NULL);
|
||||||
midori_view_apply_icon (view, icon, NULL);
|
midori_view_apply_icon (view, icon, NULL);
|
||||||
|
|
||||||
|
free_parts:
|
||||||
|
g_strfreev (parts);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|
Loading…
Reference in a new issue