Don't leak URI in midori_browser_get_uri_extension

This commit is contained in:
Christian Dywan 2010-10-14 20:27:31 +02:00
parent 72be5942f7
commit 8302cfe004

View file

@ -3196,16 +3196,14 @@ _action_view_encoding_activate (GtkAction* action,
static gchar* static gchar*
midori_browser_get_uri_extension (const gchar* uri) midori_browser_get_uri_extension (const gchar* uri)
{ {
gchar* extension;
gchar* slash; gchar* slash;
gchar* period; gchar* period;
gchar* ext_end; gchar* ext_end;
gchar* tmp = g_strdup (uri);
/* Find the last slash in the URI and search for the last period /* Find the last slash in the URI and search for the last period
*after* the last slash. This is not completely accurate *after* the last slash. This is not completely accurate
but should cover most (simple) URIs */ but should cover most (simple) URIs */
slash = strrchr (tmp, '/'); slash = strrchr (uri, '/');
/* Huh, URI without slashes? */ /* Huh, URI without slashes? */
if (!slash) if (!slash)
return g_strdup (""); return g_strdup ("");
@ -3225,11 +3223,7 @@ midori_browser_get_uri_extension (const gchar* uri)
ext_end++; ext_end++;
*ext_end = 0; *ext_end = 0;
extension = g_strdup (period); return g_strdup (period);
g_free (tmp);
return extension;
} }
static void static void