diff options
author | Owen W. Taylor <otaylor@fishsoup.net> | 2014-10-09 12:27:21 -0400 |
---|---|---|
committer | Owen W. Taylor <otaylor@fishsoup.net> | 2014-10-09 15:16:52 -0400 |
commit | 8bb0fbb02a3367b4d5f716dc71aebec401a11297 (patch) | |
tree | 4c581a97bd4827303e57dde0b1d42d338571cb30 | |
parent | eab417a368ca267510938f5aab1378080e525839 (diff) | |
download | gdm-8bb0fbb02a3367b4d5f716dc71aebec401a11297.tar.gz |
Don't leak result of g_dbus_connection_new_for_address_finish()
g_dbus_connection_new_for_address_finish() returns a new reference;
we can't simply ignore the returned connection, even though it is also
passed in as the source object of the GAsyncReadyCallback.
https://bugzilla.gnome.org/show_bug.cgi?id=738246
-rw-r--r-- | libgdm/gdm-client.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/libgdm/gdm-client.c b/libgdm/gdm-client.c index 168eabd4..1f428915 100644 --- a/libgdm/gdm-client.c +++ b/libgdm/gdm-client.c @@ -169,15 +169,17 @@ on_user_verifier_proxy_created (GObject *source, } static void -on_reauthentication_channel_connected (GDBusConnection *connection, +on_reauthentication_channel_connected (GObject *source_object, GAsyncResult *result, GSimpleAsyncResult *operation_result) { + GDBusConnection *connection; GCancellable *cancellable; GError *error; error = NULL; - if (!g_dbus_connection_new_for_address_finish (result, &error)) { + connection = g_dbus_connection_new_for_address_finish (result, &error); + if (!connection) { g_simple_async_result_take_error (operation_result, error); g_simple_async_result_complete_in_idle (operation_result); g_object_unref (operation_result); @@ -193,6 +195,7 @@ on_reauthentication_channel_connected (GDBusConnection *connection, (GAsyncReadyCallback) on_user_verifier_proxy_created, operation_result); + g_object_unref (connection); } static void @@ -311,15 +314,16 @@ gdm_client_open_connection_sync (GdmClient *client, } static void -on_connected (GDBusConnection *connection, +on_connected (GObject *source_object, GAsyncResult *result, GSimpleAsyncResult *operation_result) { + GDBusConnection *connection; GError *error; error = NULL; - if (!g_dbus_connection_new_for_address_finish (result, - &error)) { + connection = g_dbus_connection_new_for_address_finish (result, &error); + if (!connection) { g_simple_async_result_take_error (operation_result, error); g_simple_async_result_complete_in_idle (operation_result); g_object_unref (operation_result); @@ -332,6 +336,7 @@ on_connected (GDBusConnection *connection, g_object_unref); g_simple_async_result_complete_in_idle (operation_result); g_object_unref (operation_result); + g_object_unref (connection); } static void |