]> spindle.queued.net Git - midori/commitdiff
Don't leak temporary icon filename and don't free icon URI too early
authorCan Erkin Acar <canacar@openbsd.org>
Tue, 19 Jan 2010 05:09:05 +0000 (06:09 +0100)
committerChristian Dywan <christian@twotoasts.de>
Tue, 19 Jan 2010 05:09:05 +0000 (06:09 +0100)
katze/katze-utils.c

index 86a7f90ff85155c0f6023e82dff0bf2e3ca22c13..58bcadd8560bfffaf476211075d51c0c94cad2f4 100644 (file)
@@ -1457,17 +1457,18 @@ katze_load_cached_icon (const gchar* uri,
             i++;
         if (uri[i] == '/')
         {
-            icon_uri = g_strdup (uri);
-            icon_uri[i] = '\0';
-            icon_uri = g_strdup_printf ("%s/favicon.ico", icon_uri);
+            gchar* ticon_uri = g_strdup (uri);
+            ticon_uri[i] = '\0';
+            icon_uri = g_strdup_printf ("%s/favicon.ico", ticon_uri);
+            g_free (ticon_uri);
         }
         else
             icon_uri = g_strdup_printf ("%s/favicon.ico", uri);
 
         checksum = g_compute_checksum_for_string (G_CHECKSUM_MD5, icon_uri, -1);
         ext = g_strrstr (icon_uri, ".");
-        g_free (icon_uri);
         filename = g_strdup_printf ("%s%s", checksum, ext ? ext : "");
+        g_free (icon_uri);
         g_free (checksum);
         path = g_build_filename (g_get_user_cache_dir (), PACKAGE_NAME,
                                  "icons", filename, NULL);