[evolution-patches] patch for libsoup



Hi

This is a patch for libsoup to fix memory leak, please review it.

Regards,

Jedy
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/libsoup/ChangeLog,v
retrieving revision 1.473
diff -u -r1.473 ChangeLog
--- ChangeLog	30 Aug 2005 00:54:55 -0000	1.473
+++ ChangeLog	20 Oct 2005 11:35:25 -0000
@@ -1,3 +1,10 @@
+2005-10-20  Wang Xin  <jedy wang sun com>
+
+	Fix memory leak.
+
+	* libsoup/soup-socket.c: (soup_socket_connect),
+	(soup_socket_client_new_async), (soup_socket_client_new_sync):
+
 2005-08-30  Tor Lillqvist  <tml novell com>
 
 	* libsoup-zip.in: Include documentation in developer zipfile.
Index: libsoup/soup-socket.c
===================================================================
RCS file: /cvs/gnome/libsoup/libsoup/soup-socket.c,v
retrieving revision 1.61
diff -u -r1.61 soup-socket.c
--- libsoup/soup-socket.c	15 Aug 2005 11:25:04 -0000	1.61
+++ libsoup/soup-socket.c	20 Oct 2005 11:35:27 -0000
@@ -542,7 +542,8 @@
 	g_return_val_if_fail (priv->sockfd == -1, SOUP_STATUS_MALFORMED);
 	g_return_val_if_fail (SOUP_IS_ADDRESS (remote_addr), SOUP_STATUS_MALFORMED);
 
-	priv->remote_addr = g_object_ref (remote_addr);
+	if (priv->remote_addr == NULL)
+		priv->remote_addr = g_object_ref (remote_addr);
 	if (!priv->non_blocking) {
 		status = soup_address_resolve_sync (remote_addr);
 		if (!SOUP_STATUS_IS_SUCCESSFUL (status))
@@ -763,13 +764,18 @@
 			      SoupSocketCallback callback, gpointer user_data)
 {
 	SoupSocket *sock;
+	SoupAddress *addr;
 
 	g_return_val_if_fail (hostname != NULL, NULL);
 
+	addr = soup_address_new (hostname, port);
+	if (!addr)
+		return NULL;
 	sock = g_object_new (SOUP_TYPE_SOCKET,
 			     SOUP_SOCKET_SSL_CREDENTIALS, ssl_creds,
 			     NULL);
-	soup_socket_connect (sock, soup_address_new (hostname, port));
+	soup_socket_connect (sock, addr);
+	g_object_unref (addr);
 
 	if (callback) {
 		soup_signal_connect_once (sock, "connect_result",
@@ -795,17 +801,22 @@
 			     gpointer ssl_creds, guint *status_ret)
 {
 	SoupSocket *sock;
+	SoupAddress *addr;
 	SoupSocketPrivate *priv;
 	guint status;
 
 	g_return_val_if_fail (hostname != NULL, NULL);
 
+	addr = soup_address_new (hostname, port);
+	if (!addr)
+		return NULL;
 	sock = g_object_new (SOUP_TYPE_SOCKET,
 			     SOUP_SOCKET_SSL_CREDENTIALS, ssl_creds,
 			     NULL);
 	priv = SOUP_SOCKET_GET_PRIVATE (sock);
 	priv->non_blocking = FALSE;
-	status = soup_socket_connect (sock, soup_address_new (hostname, port));
+	status = soup_socket_connect (sock, addr);
+	g_object_unref (addr);
 
 	if (!SOUP_STATUS_IS_SUCCESSFUL (status)) {
 		g_object_unref (sock);


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