From a5fd31e66fbfd09981b387aff5fac682ad56fe17 Mon Sep 17 00:00:00 2001 From: Evgeny Vereshchagin Date: Tue, 5 Jan 2016 15:35:23 +0000 Subject: [PATCH] tests: use sd_bus_flush_close_unref instead of sd_bus_unref in test-bus-cleanup Fixes: $ make valgrind-tests TESTS=test-bus-cleanup ==6363== 9 bytes in 1 blocks are possibly lost in loss record 1 of 28 ==6363== at 0x4C2BBCF: malloc (vg_replace_malloc.c:299) ==6363== by 0x197D12: hexmem (hexdecoct.c:79) ==6363== by 0x183083: bus_socket_start_auth_client (bus-socket.c:639) ==6363== by 0x1832A0: bus_socket_start_auth (bus-socket.c:678) ==6363== by 0x183438: bus_socket_connect (bus-socket.c:705) ==6363== by 0x14B0F2: bus_start_address (sd-bus.c:1053) ==6363== by 0x14B592: sd_bus_start (sd-bus.c:1134) ==6363== by 0x14B95E: sd_bus_open_system (sd-bus.c:1235) ==6363== by 0x1127E2: test_bus_open (test-bus-cleanup.c:42) ==6363== by 0x112AAE: main (test-bus-cleanup.c:87) ==6363== ... $ ./libtool --mode=execute valgrind ./test-bus-cleanup ==6584== LEAK SUMMARY: ... ==6584== possibly lost: 10,566 bytes in 27 blocks --- src/libsystemd/sd-bus/test-bus-cleanup.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libsystemd/sd-bus/test-bus-cleanup.c b/src/libsystemd/sd-bus/test-bus-cleanup.c index 1c3ccda..cbc450f 100644 --- a/src/libsystemd/sd-bus/test-bus-cleanup.c +++ b/src/libsystemd/sd-bus/test-bus-cleanup.c @@ -36,7 +36,7 @@ static void test_bus_new(void) { } static int test_bus_open(void) { - _cleanup_(sd_bus_unrefp) sd_bus *bus = NULL; + _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL; int r; r = sd_bus_open_system(&bus); @@ -59,8 +59,8 @@ static void test_bus_new_method_call(void) { printf("after message_new_method_call: refcount %u\n", REFCNT_GET(bus->n_ref)); - sd_bus_unref(bus); - printf("after bus_unref: refcount %u\n", m->n_ref); + sd_bus_flush_close_unref(bus); + printf("after bus_flush_close_unref: refcount %u\n", m->n_ref); } static void test_bus_new_signal(void) { @@ -73,8 +73,8 @@ static void test_bus_new_signal(void) { printf("after message_new_signal: refcount %u\n", REFCNT_GET(bus->n_ref)); - sd_bus_unref(bus); - printf("after bus_unref: refcount %u\n", m->n_ref); + sd_bus_flush_close_unref(bus); + printf("after bus_flush_close_unref: refcount %u\n", m->n_ref); } int main(int argc, char **argv) { -- 2.7.4