public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Haochen Tong <i@hexchain.org>
To: linux-bluetooth@vger.kernel.org
Cc: Haochen Tong <i@hexchain.org>
Subject: [PATCH BlueZ] tools/mpris-proxy: unregister object path if player registration fails
Date: Mon, 26 Sep 2022 00:31:39 +0800	[thread overview]
Message-ID: <20220925163139.194382-1-i@hexchain.org> (raw)

The `owner' string, passed as user data, is freed if the player fails
registration, but the object path still exists. Upon program exiting,
the lingering path will be enumerated and the attached user data will be
freed again.
---
 tools/mpris-proxy.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/mpris-proxy.c b/tools/mpris-proxy.c
index 3779b6887..e5fc91fdb 100644
--- a/tools/mpris-proxy.c
+++ b/tools/mpris-proxy.c
@@ -480,6 +480,7 @@ static void add_player(DBusConnection *conn, const char *name,
 	reply = dbus_connection_send_with_reply_and_block(sys, msg, -1, &err);
 	if (!reply) {
 		fprintf(stderr, "Can't register player\n");
+		dbus_connection_unregister_object_path(sys, path);
 		free(owner);
 		if (dbus_error_is_set(&err)) {
 			fprintf(stderr, "%s\n", err.message);
-- 
2.37.3


             reply	other threads:[~2022-09-25 16:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-25 16:31 Haochen Tong [this message]
2022-09-25 17:35 ` [BlueZ] tools/mpris-proxy: unregister object path if player registration fails bluez.test.bot
2022-09-26 18:00 ` [PATCH BlueZ] " patchwork-bot+bluetooth

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=20220925163139.194382-1-i@hexchain.org \
    --to=i@hexchain.org \
    --cc=linux-bluetooth@vger.kernel.org \
    /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