From d9dab2b31904fb6eeae72014d0946874baaa65a8 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 20 Feb 2020 11:23:50 +0000 Subject: [PATCH] gdbusproxy: Tidy up some memory management code Use `g_clear_object()` to tidy things up. This introduces no functional changes. Signed-off-by: Philip Withnall --- gio/gdbusproxy.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/gio/gdbusproxy.c b/gio/gdbusproxy.c index f3b02ccce..22ccc830f 100644 --- a/gio/gdbusproxy.c +++ b/gio/gdbusproxy.c @@ -889,8 +889,7 @@ on_signal_received (GDBusConnection *connection, parameters); out: - if (proxy != NULL) - g_object_unref (proxy); + g_clear_object (&proxy); } /* ---------------------------------------------------------------------------------------------------- */ @@ -1101,11 +1100,9 @@ on_properties_changed (GDBusConnection *connection, } out: - if (changed_properties != NULL) - g_variant_unref (changed_properties); + g_clear_pointer (&changed_properties, g_variant_unref); g_free (invalidated_properties); - if (proxy != NULL) - g_object_unref (proxy); + g_clear_object (&proxy); } /* ---------------------------------------------------------------------------------------------------- */ @@ -1357,8 +1354,7 @@ on_name_owner_changed (GDBusConnection *connection, } out: - if (proxy != NULL) - g_object_unref (proxy); + g_clear_object (&proxy); } /* ---------------------------------------------------------------------------------------------------- */