From: Simon McVittie Date: Wed, 28 Jun 2017 17:49:18 +0000 (+0100) Subject: test/loopback: Don't leak address strings X-Git-Tag: dbus-1.11.14~13 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fe19134bb6194ea2bc2d23da4d5f608cb7c8b702;p=thirdparty%2Fdbus.git test/loopback: Don't leak address strings dbus_server_get_address() returns a copy. It isn't clear why. Signed-off-by: Simon McVittie Reviewed-by: Philip Withnall Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101567 --- diff --git a/test/loopback.c b/test/loopback.c index 5232a09a5..46e9758d4 100644 --- a/test/loopback.c +++ b/test/loopback.c @@ -160,10 +160,12 @@ static void test_connect (Fixture *f, gconstpointer addr G_GNUC_UNUSED) { + char *address; g_assert (f->server_conn == NULL); - f->client_conn = dbus_connection_open_private ( - dbus_server_get_address (f->server), &f->e); + address = dbus_server_get_address (f->server); + g_test_message ("listening at %s", address); + f->client_conn = dbus_connection_open_private (address, &f->e); assert_no_error (&f->e); g_assert (f->client_conn != NULL); test_connection_setup (f->ctx, f->client_conn); @@ -173,6 +175,8 @@ test_connect (Fixture *f, test_progress ('.'); test_main_context_iterate (f->ctx, TRUE); } + + dbus_free (address); } static void @@ -180,7 +184,7 @@ test_bad_guid (Fixture *f, gconstpointer addr G_GNUC_UNUSED) { DBusMessage *incoming; - gchar *address = g_strdup (dbus_server_get_address (f->server)); + char *address = dbus_server_get_address (f->server); gchar *guid; g_test_bug ("39720"); @@ -232,7 +236,7 @@ test_bad_guid (Fixture *f, dbus_message_unref (incoming); - g_free (address); + dbus_free (address); } static void