summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2017-06-28 18:49:18 +0100
committerSimon McVittie <smcv@collabora.com>2017-06-29 14:03:30 +0100
commitfe19134bb6194ea2bc2d23da4d5f608cb7c8b702 (patch)
treefdba315ccea402f08f599f951f6b810b9442b0c4 /test
parentb951c5006cb8dcd1ec18d9466cbc5a087bc26776 (diff)
test/loopback: Don't leak address strings
dbus_server_get_address() returns a copy. It isn't clear why. Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101567
Diffstat (limited to 'test')
-rw-r--r--test/loopback.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/test/loopback.c b/test/loopback.c
index 5232a09a..46e9758d 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