telepathy-idle: ServerConnection: ensure socket connection is not leaked

Simon McVittie smcv at kemper.freedesktop.org
Wed May 1 09:01:43 PDT 2013


Module: telepathy-idle
Branch: master
Commit: 18155960b9034f6adfafe67b6c0560ad3ef40252
URL:    http://cgit.freedesktop.org/telepathy/telepathy-idle/commit/?id=18155960b9034f6adfafe67b6c0560ad3ef40252

Author: Will Thompson <will.thompson at collabora.co.uk>
Date:   Tue Apr 30 19:08:15 2013 +0100

ServerConnection: ensure socket connection is not leaked

If we cancel the connect_async cancellable between the call to
g_task_return_pointer (which schedules an idle to call the callback) and
Connection calling connect_finish(), the socket_connection would
previously have leaked.

---

 src/idle-server-connection.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/idle-server-connection.c b/src/idle-server-connection.c
index 9620fd8..0795e63 100644
--- a/src/idle-server-connection.c
+++ b/src/idle-server-connection.c
@@ -394,7 +394,7 @@ static void _connect_in_thread (GTask *task, gpointer source_object, gpointer ta
 	socket_connection = g_socket_client_connect_to_host (priv->socket_client, priv->host, priv->port, cancellable, &error);
 	g_signal_handler_disconnect (priv->socket_client, event_id);
 	if (socket_connection != NULL)
-		g_task_return_pointer (task, socket_connection, NULL);
+		g_task_return_pointer (task, socket_connection, g_object_unref);
 	else
 		g_task_return_error (task, error);
 }



More information about the telepathy-commits mailing list