dbus: client: monitor: free the line list at exit
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Mon, 7 Oct 2024 19:30:24 +0000 (21:30 +0200)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Wed, 9 Oct 2024 07:33:36 +0000 (09:33 +0200)
Free the list of line proxies stored for the duration of the program at
exit to fix a memory leak.

Note: these objects need to be kept alive for D-Bus events to work.

Fixes: a5ab76da1e0a ("dbus: add the D-Bus daemon, command-line client and tests")
Link: https://lore.kernel.org/r/20241007-dbus-memory-fixes-v1-3-0d56d1aa032d@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
dbus/client/monitor.c

index 3bd25b870f9ded5e1078821ee1bcfff5d5e755ab..df7eb51cbe375c1d981a3872a22860d87f2090ce 100644 (file)
@@ -185,6 +185,7 @@ int gpiocli_monitor_main(int argc, char **argv)
 
        g_main_loop_run(loop);
 
+       g_list_free_full(data.lines, g_object_unref);
        g_bus_unwatch_name(watch_id);
 
        return EXIT_SUCCESS;