From 9b01e48975bc3f1a472e397c3a1f0171a767bbe3 Mon Sep 17 00:00:00 2001 From: Alexander Butenko Date: Thu, 14 Jan 2010 02:23:00 +0100 Subject: [PATCH] Tell the soup message it was finished to allow it to release memory --- extensions/web-cache.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/extensions/web-cache.c b/extensions/web-cache.c index f0906a4b..df5b8ce0 100644 --- a/extensions/web-cache.c +++ b/extensions/web-cache.c @@ -227,7 +227,6 @@ web_cache_message_rewrite (SoupMessage* msg, soup_message_headers_replace (msg->response_headers, key, value); g_signal_emit_by_name (msg, "got-headers", NULL); - msg->response_body = soup_message_body_new (); g_file_get_contents (filename, &data, &length, NULL); if (data && length) { @@ -236,9 +235,10 @@ web_cache_message_rewrite (SoupMessage* msg, soup_message_body_append_buffer (msg->response_body, buffer); g_signal_emit_by_name (msg, "got-chunk", buffer, NULL); soup_buffer_free (buffer); + g_free (data); } soup_message_got_body (msg); - g_free (data); + soup_message_finished (msg); } static void @@ -287,9 +287,8 @@ web_cache_mesage_got_headers_cb (SoupMessage* msg, } if (web_cache_save_headers (msg, filename)) { - g_signal_connect_data (msg, "got-chunk", - G_CALLBACK (web_cache_message_got_chunk_cb), - filename, (GClosureNotify)g_free, 0); + g_signal_connect (msg, "got-chunk", + G_CALLBACK (web_cache_message_got_chunk_cb), filename); g_signal_connect (msg, "finished", G_CALLBACK (web_cache_message_finished_cb), filename); } -- 2.39.5