From: Can Erkin Acar Date: Tue, 19 Jan 2010 05:09:05 +0000 (+0100) Subject: Don't leak temporary icon filename and don't free icon URI too early X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7fd68c1734318deb6c6809d98a2583ce70acfb4;p=midori Don't leak temporary icon filename and don't free icon URI too early --- diff --git a/katze/katze-utils.c b/katze/katze-utils.c index 86a7f90f..58bcadd8 100644 --- a/katze/katze-utils.c +++ b/katze/katze-utils.c @@ -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);