From 7738e9ac416b8dd9aa8f3209b75554f85836c5f0 Mon Sep 17 00:00:00 2001 From: Haochen Tong Date: Mon, 26 Sep 2022 00:31:39 +0800 Subject: [PATCH] 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. --- 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.47.3