From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Kent Gibson <warthog618@gmail.com>,
Linus Walleij <linus.walleij@linaro.org>
Cc: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
linux-gpio@vger.kernel.org
Subject: [PATCH libgpiod 3/3] dbus: client: monitor: free the line list at exit
Date: Mon, 07 Oct 2024 21:30:24 +0200 [thread overview]
Message-ID: <20241007-dbus-memory-fixes-v1-3-0d56d1aa032d@linaro.org> (raw)
In-Reply-To: <20241007-dbus-memory-fixes-v1-0-0d56d1aa032d@linaro.org>
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
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")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
dbus/client/monitor.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/dbus/client/monitor.c b/dbus/client/monitor.c
index 3bd25b8..df7eb51 100644
--- a/dbus/client/monitor.c
+++ b/dbus/client/monitor.c
@@ -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;
--
2.43.0
next prev parent reply other threads:[~2024-10-07 19:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-07 19:30 [PATCH libgpiod 0/3] dbus: client: fix memory leaks and errors Bartosz Golaszewski
2024-10-07 19:30 ` [PATCH libgpiod 1/3] dbus: client: notify: fix reference counting Bartosz Golaszewski
2024-10-07 19:30 ` [PATCH libgpiod 2/3] dbus: client: notify: free chip and line lists at exit Bartosz Golaszewski
2024-10-07 19:30 ` Bartosz Golaszewski [this message]
2024-10-09 7:33 ` [PATCH libgpiod 0/3] dbus: client: fix memory leaks and errors Bartosz Golaszewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241007-dbus-memory-fixes-v1-3-0d56d1aa032d@linaro.org \
--to=brgl@bgdev.pl \
--cc=bartosz.golaszewski@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=warthog618@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).