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.
static void* client1(void*p) {
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
static void* client1(void*p) {
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
+ _cleanup_bus_close_unref_ sd_bus *bus = NULL;
sd_bus_error error = SD_BUS_ERROR_NULL;
const char *hello;
int r;
sd_bus_error error = SD_BUS_ERROR_NULL;
const char *hello;
int r;
else
sd_bus_send(bus, q, NULL);
else
sd_bus_send(bus, q, NULL);
- sd_bus_flush(bus);
- sd_bus_unref(bus);
}
sd_bus_error_free(&error);
}
sd_bus_error_free(&error);