[glib] GSocketClient: plug two leaks
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] GSocketClient: plug two leaks
- Date: Sat, 14 Aug 2010 20:17:12 +0000 (UTC)
commit b76b24f1b3f82c2400cce8948b44ae32aa0e23ee
Author: Dan Winship <danw gnome org>
Date: Sat Aug 14 16:15:39 2010 -0400
GSocketClient: plug two leaks
g_socket_client_connect_async() was always leaking its GCancellable,
and would also leak any GSocket that eventually failed to connect
after returning G_IO_ERROR_PENDING.
gio/gsocketclient.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/gio/gsocketclient.c b/gio/gsocketclient.c
index 37b0b59..a4d4ea9 100644
--- a/gio/gsocketclient.c
+++ b/gio/gsocketclient.c
@@ -751,6 +751,8 @@ g_socket_client_async_connect_complete (GSocketClientAsyncConnectData *data)
g_simple_async_result_complete (data->result);
g_object_unref (data->result);
g_object_unref (data->enumerator);
+ if (data->cancellable)
+ g_object_unref (data->cancellable);
g_slice_free (GSocketClientAsyncConnectData, data);
}
@@ -790,6 +792,8 @@ g_socket_client_socket_callback (GSocket *socket,
if (!g_socket_check_connect_result (data->current_socket, &error))
{
set_last_error (data, error);
+ g_object_unref (data->current_socket);
+ data->current_socket = NULL;
/* try next one */
g_socket_address_enumerator_next_async (data->enumerator,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]