[Xfce4-commits] <midori:master> Don't leak URI in midori_browser_get_uri_extension

Christian Dywan noreply at xfce.org
Thu Oct 14 21:18:02 CEST 2010


Updating branch refs/heads/master
         to 8302cfe004a12f8f2af1d565f2d1122a26187758 (commit)
       from 72be5942f7b5bebb891514038065c434fcda2f83 (commit)

commit 8302cfe004a12f8f2af1d565f2d1122a26187758
Author: Christian Dywan <christian at twotoasts.de>
Date:   Thu Oct 14 20:27:31 2010 +0200

    Don't leak URI in midori_browser_get_uri_extension

 midori/midori-browser.c |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)

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



More information about the Xfce4-commits mailing list