]> spindle.queued.net Git - midori/commitdiff
Tell the soup message it was finished to allow it to release memory
authorAlexander Butenko <a.butenka@gmail.com>
Thu, 14 Jan 2010 01:23:00 +0000 (02:23 +0100)
committerChristian Dywan <christian@twotoasts.de>
Thu, 14 Jan 2010 01:23:00 +0000 (02:23 +0100)
extensions/web-cache.c

index f0906a4ba57c9a8c127fedeebca48d4db9929933..df5b8ce0d43bffe2b0c09e53389b2f71c4e4825a 100644 (file)
@@ -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);
         }