[evolution-patches] soup leaks



The plugs up the largest remaining soup leak, as well as two smaller
NTLM-related ones.

The change to soup_message_cleanup is something I tried while hunting
down the leak, but after looking further, I realized it was both useless
and bogus. (That code path will only be hit when the response body
hasn't been set.)

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/libsoup/ChangeLog,v
retrieving revision 1.316
diff -u -r1.316 ChangeLog
--- ChangeLog	26 Jun 2003 16:26:42 -0000	1.316
+++ ChangeLog	28 Jul 2003 20:00:38 -0000
@@ -1,3 +1,17 @@
+2003-07-28  Dan Winship  <danw ximian com>
+
+	* libsoup/soup-message.c (requeue_read_finished,
+	release_connection): Free the passed-in body data. Otherwise the
+	response body ends up getting leaked on most 3xx and 4xx
+	responses.
+	(soup_message_cleanup): Remove a piece of code that didn't
+	actually do anything and its associated confused comment.
+
+	* libsoup/soup-auth.c (ntlm_free): plug an occasional NTLM auth leak
+
+	* libsoup/soup-context.c (connection_free): plug a non-occasional
+	NTLM auth leak.
+
 2003-06-26  Joe Shaw  <joe ximian com>
 
 	* configure.in: Version 1.99.24
Index: libsoup/soup-auth.c
===================================================================
RCS file: /cvs/gnome/libsoup/libsoup/soup-auth.c,v
retrieving revision 1.20
diff -u -r1.20 soup-auth.c
--- libsoup/soup-auth.c	9 May 2003 15:25:30 -0000	1.20
+++ libsoup/soup-auth.c	28 Jul 2003 20:00:38 -0000
@@ -541,6 +541,7 @@
 	SoupAuthNTLM *auth = (SoupAuthNTLM *) sa;
 
 	g_free (auth->response);
+	g_free (auth->header);
 	g_free (auth);
 }
 
Index: libsoup/soup-context.c
===================================================================
RCS file: /cvs/gnome/libsoup/libsoup/soup-context.c,v
retrieving revision 1.49
diff -u -r1.49 soup-context.c
--- libsoup/soup-context.c	9 May 2003 15:25:30 -0000	1.49
+++ libsoup/soup-context.c	28 Jul 2003 20:00:38 -0000
@@ -257,6 +257,11 @@
 	conn->server->connections =
 		g_slist_remove (conn->server->connections, conn);
 
+	if (conn->auth) {
+		soup_auth_invalidate (conn->auth, conn->context);
+		soup_auth_free (conn->auth);
+	}
+
 	g_io_channel_unref (conn->channel);
 	soup_context_unref (conn->context);
 	soup_socket_unref (conn->socket);
Index: libsoup/soup-message.c
===================================================================
RCS file: /cvs/gnome/libsoup/libsoup/soup-message.c,v
retrieving revision 1.58
diff -u -r1.58 soup-message.c
--- libsoup/soup-message.c	17 Jun 2003 12:24:12 -0000	1.58
+++ libsoup/soup-message.c	28 Jul 2003 20:00:38 -0000
@@ -147,6 +147,9 @@
 {
 	SoupConnection *conn = user_data;
 	soup_connection_release (conn);
+
+	if (data->owner == SOUP_BUFFER_SYSTEM_OWNED)
+		g_free (data->body);
 }
 
 static void 
@@ -183,11 +186,6 @@
 		soup_transfer_read_unref (req->priv->read_tag);
 		req->priv->read_tag = NULL;
 		req->connection = NULL;
-		/* 
-		 * The buffer doesn't belong to us until the message is 
-		 * finished.
-		 */
-		req->response.owner = SOUP_BUFFER_STATIC;
 	}
 
 	if (req->priv->read_tag) {
@@ -543,6 +541,9 @@
 {
 	SoupMessage *msg = user_data;
 	SoupConnection *conn = msg->connection;
+
+	if (buf->owner == SOUP_BUFFER_SYSTEM_OWNED)
+		g_free (buf->body);
 
 	soup_connection_set_used (msg->connection);
 	if (!soup_connection_is_keep_alive (msg->connection))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]