diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2023-05-01 12:27:20 -0700 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2023-05-01 12:27:20 -0700 |
commit | 416b8375ffde990c1ec443be0961b9ada38da75b (patch) | |
tree | 3a6465355455a45ea7dffefe01947ed6aa487f36 /client/player.c | |
parent | f9376b13b3fe67430239037fbfc28ad2828bd3b3 (diff) | |
download | bluez-416b8375ffde990c1ec443be0961b9ada38da75b.tar.gz |
client/player: Fix crash when RegisterEndpoint fails
If RegisterEndpoint fails when there are multiple adapters it would
attempt to free the same endpoint multiple times.
Diffstat (limited to 'client/player.c')
-rw-r--r-- | client/player.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/client/player.c b/client/player.c index cc35721d8..7719076c8 100644 --- a/client/player.c +++ b/client/player.c @@ -2028,9 +2028,11 @@ static void register_endpoint_reply(DBusMessage *message, void *user_data) bt_shell_printf("Failed to register endpoint: %s\n", error.name); dbus_error_free(&error); - local_endpoints = g_list_remove(local_endpoints, ep); - g_dbus_unregister_interface(dbus_conn, ep->path, + if (g_list_find(local_endpoints, ep)) { + local_endpoints = g_list_remove(local_endpoints, ep); + g_dbus_unregister_interface(dbus_conn, ep->path, BLUEZ_MEDIA_ENDPOINT_INTERFACE); + } return bt_shell_noninteractive_quit(EXIT_FAILURE); } |