diff options
author | Cristian RodrÃguez <crrodriguez@opensuse.org> | 2015-05-09 22:14:09 -0300 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-05-14 22:36:35 +0200 |
commit | 2f50a2d55bf0a8b5959a6864ae1b39e7e9e0ce08 (patch) | |
tree | 779c6ffc76df26e341c2704fb0a7435c1037fb99 | |
parent | 1dff3202941786dd00060f078f6b031efe52d3c3 (diff) |
sd-bus: fix memory leak in test-bus-chat
Building with address sanitizer enabled on GCC 5.1.x a memory leak
is reported because we never close the bus, fix it by using
cleanup variable attribute.
-rw-r--r-- | src/libsystemd/sd-bus/test-bus-chat.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/libsystemd/sd-bus/test-bus-chat.c b/src/libsystemd/sd-bus/test-bus-chat.c index 99261fa4c9..1e50dfc433 100644 --- a/src/libsystemd/sd-bus/test-bus-chat.c +++ b/src/libsystemd/sd-bus/test-bus-chat.c @@ -262,7 +262,7 @@ fail: static void* client1(void*p) { _cleanup_bus_message_unref_ sd_bus_message *reply = NULL; - sd_bus *bus = NULL; + _cleanup_bus_close_unref_ sd_bus *bus = NULL; sd_bus_error error = SD_BUS_ERROR_NULL; const char *hello; int r; @@ -345,8 +345,6 @@ finish: else sd_bus_send(bus, q, NULL); - sd_bus_flush(bus); - sd_bus_unref(bus); } sd_bus_error_free(&error); |