From f5210e1902b4c70e58f199280ac144d8fd74a8ac Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 28 Jul 2017 12:47:59 +0100 Subject: [PATCH] ratbagd: remove devices before removing the context This code isn't actually hit because we don't handle signals correctly, but once we do, ratbagd_free() will assert because the devices never get removed. Signed-off-by: Peter Hutterer --- ratbagd/ratbagd.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ratbagd/ratbagd.c b/ratbagd/ratbagd.c index 82f7d90c..61f32dc7 100644 --- a/ratbagd/ratbagd.c +++ b/ratbagd/ratbagd.c @@ -485,9 +485,14 @@ static const struct ratbag_interface ratbagd_lib_interface = { static struct ratbagd *ratbagd_free(struct ratbagd *ctx) { + struct ratbagd_device *device; + if (!ctx) return NULL; + RATBAGD_DEVICE_FOREACH(device, ctx) + ratbagd_device_unlink(device); + ctx->bus = sd_bus_flush_close_unref(ctx->bus); ctx->monitor_source = sd_event_source_unref(ctx->monitor_source); ctx->monitor = udev_monitor_unref(ctx->monitor);