summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCristian Rodríguez <crrodriguez@opensuse.org>2015-05-09 22:14:09 -0300
committerSven Eden <yamakuzure@gmx.net>2017-03-14 08:23:32 +0100
commit0666b7f8f0ab1bf562c3c33dcdc4b3fca3baa868 (patch)
treeaa3a4231fe473f1f95212ffb95ad3fc4aa368376 /src
parentef01fb10f7a4159a2d2800d2c7c60b247e575ba7 (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.
Diffstat (limited to 'src')
-rw-r--r--src/libelogind/sd-bus/test-bus-chat.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/libelogind/sd-bus/test-bus-chat.c b/src/libelogind/sd-bus/test-bus-chat.c
index 99261fa4c..1e50dfc43 100644
--- a/src/libelogind/sd-bus/test-bus-chat.c
+++ b/src/libelogind/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);