summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorHaochen Tong <i@hexchain.org>2022-09-26 00:31:39 +0800
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2022-09-26 10:57:01 -0700
commit7738e9ac416b8dd9aa8f3209b75554f85836c5f0 (patch)
treeba2baf67993944c3818af6c83770d26680f45e83 /tools
parente01e89179d4ef8016f5593674834084ca549ca2a (diff)
downloadbluez-7738e9ac416b8dd9aa8f3209b75554f85836c5f0.tar.gz
tools/mpris-proxy: unregister object path if player registration fails
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.
Diffstat (limited to 'tools')
-rw-r--r--tools/mpris-proxy.c1
1 files changed, 1 insertions, 0 deletions
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);