summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2017-11-27 19:14:57 +0000
committerSimon McVittie <smcv@collabora.com>2017-12-04 11:52:40 +0000
commitd5d7d099798ff780dce73236bd4b33fe3c0dd9b5 (patch)
tree0ed91b10614b7fe6ca12183b531978d0f376b9a2
parentecbcffae19ff1b811fc7d0d602458c0f00dd6771 (diff)
test_try_connect_to_bus: Don't leak the connection on OOM
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=100317 Reviewed-by: Philip Withnall <withnall@endlessm.com> Signed-off-by: Simon McVittie <smcv@collabora.com>
-rw-r--r--test/test-utils-glib.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/test-utils-glib.c b/test/test-utils-glib.c
index a539c5c84..fd804c967 100644
--- a/test/test-utils-glib.c
+++ b/test/test-utils-glib.c
@@ -353,6 +353,12 @@ fail:
if (gerror != NULL)
*gerror = g_dbus_error_new_for_dbus_error (error.name, error.message);
+ if (conn != NULL)
+ {
+ dbus_connection_close (conn);
+ dbus_connection_unref (conn);
+ }
+
dbus_error_free (&error);
return FALSE;
}