mirror of
https://github.com/systemd/systemd
synced 2024-09-06 08:46:19 +00:00
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.
This commit is contained in:
parent
1dff320294
commit
2f50a2d55b
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue