Skip to content

Commit

Permalink
tools/mpris-proxy: unregister object path if player registration fails
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hexchain authored and Vudentz committed Sep 26, 2022
1 parent e01e891 commit 7738e9a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tools/mpris-proxy.c
Expand Up @@ -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);
Expand Down

0 comments on commit 7738e9a

Please sign in to comment.