From: Christian Dywan Date: Mon, 26 Oct 2009 22:46:21 +0000 (+0100) Subject: Plug two filename leaks in the web cache X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0eec63762f8c2190ee9c1cfdc4cc68f6eb8e0dc2;p=midori Plug two filename leaks in the web cache --- diff --git a/extensions/web-cache.c b/extensions/web-cache.c index e36bc402..425ea6b4 100644 --- a/extensions/web-cache.c +++ b/extensions/web-cache.c @@ -133,6 +133,8 @@ web_cache_save_headers (SoupMessage* msg, while (soup_message_headers_iter_next (&iter, &name, &value)) g_fprintf (dscfd, "%s: %s\n", name, value); fclose (dscfd); + + g_free (dsc_filename); } GHashTable* @@ -271,6 +273,7 @@ web_cache_mesage_got_headers_cb (SoupMessage* msg, G_REGEX_CASELESS, G_REGEX_MATCH_NOTEMPTY)) { g_free (uri); + g_free (filename); return; } } @@ -281,17 +284,17 @@ web_cache_mesage_got_headers_cb (SoupMessage* msg, g_signal_handlers_disconnect_by_func (msg, web_cache_mesage_got_headers_cb, extension); web_cache_message_rewrite (msg, filename); + g_free (filename); } else if (msg->status_code == SOUP_STATUS_OK) { /* g_debug ("updating cache: %s -> %s", uri, filename); */ web_cache_save_headers (msg, filename); /* FIXME: Do we need to disconnect signal after we are in unqueue? */ - g_signal_connect (msg, "got-chunk", - G_CALLBACK (web_cache_message_got_chunk_cb), filename); + g_signal_connect_data (msg, "got-chunk", + G_CALLBACK (web_cache_message_got_chunk_cb), + filename, (GClosureNotify)g_free, 0); } - /* FIXME: how to free this? - g_free (filename); */ g_free (uri); }