Don't leak temporary icon filename and don't free icon URI too early
This commit is contained in:
parent
97a5eb0df2
commit
b7fd68c173
1 changed files with 5 additions and 4 deletions
|
@ -1457,17 +1457,18 @@ katze_load_cached_icon (const gchar* uri,
|
||||||
i++;
|
i++;
|
||||||
if (uri[i] == '/')
|
if (uri[i] == '/')
|
||||||
{
|
{
|
||||||
icon_uri = g_strdup (uri);
|
gchar* ticon_uri = g_strdup (uri);
|
||||||
icon_uri[i] = '\0';
|
ticon_uri[i] = '\0';
|
||||||
icon_uri = g_strdup_printf ("%s/favicon.ico", icon_uri);
|
icon_uri = g_strdup_printf ("%s/favicon.ico", ticon_uri);
|
||||||
|
g_free (ticon_uri);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
icon_uri = g_strdup_printf ("%s/favicon.ico", uri);
|
icon_uri = g_strdup_printf ("%s/favicon.ico", uri);
|
||||||
|
|
||||||
checksum = g_compute_checksum_for_string (G_CHECKSUM_MD5, icon_uri, -1);
|
checksum = g_compute_checksum_for_string (G_CHECKSUM_MD5, icon_uri, -1);
|
||||||
ext = g_strrstr (icon_uri, ".");
|
ext = g_strrstr (icon_uri, ".");
|
||||||
g_free (icon_uri);
|
|
||||||
filename = g_strdup_printf ("%s%s", checksum, ext ? ext : "");
|
filename = g_strdup_printf ("%s%s", checksum, ext ? ext : "");
|
||||||
|
g_free (icon_uri);
|
||||||
g_free (checksum);
|
g_free (checksum);
|
||||||
path = g_build_filename (g_get_user_cache_dir (), PACKAGE_NAME,
|
path = g_build_filename (g_get_user_cache_dir (), PACKAGE_NAME,
|
||||||
"icons", filename, NULL);
|
"icons", filename, NULL);
|
||||||
|
|
Loading…
Reference in a new issue