diff mbox series

[BlueZ] tools/mpris-proxy: unregister object path if player registration fails

Message ID 20220925163139.194382-1-i@hexchain.org
State New
Headers show
Series [BlueZ] tools/mpris-proxy: unregister object path if player registration fails | expand

Commit Message

Haochen Tong Sept. 25, 2022, 4:31 p.m. UTC
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 mbox series

Patch

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);