bluez5: unregister HSP dbus object paths when current HSP/HFP registration fails

This commit is contained in:
Huang-Huang 2021-02-01 00:01:23 +08:00
parent c778bd734c
commit b66e67db14
No known key found for this signature in database
GPG key ID: 33C3271387A13D1B

View file

@ -1054,7 +1054,7 @@ struct spa_bt_backend *backend_native_new(struct spa_bt_monitor *monitor,
if (!dbus_connection_register_object_path(backend->conn, if (!dbus_connection_register_object_path(backend->conn,
PROFILE_HSP_HS, PROFILE_HSP_HS,
&vtable_profile, backend)) { &vtable_profile, backend)) {
goto fail; goto fail1;
} }
#endif #endif
@ -1062,11 +1062,17 @@ struct spa_bt_backend *backend_native_new(struct spa_bt_monitor *monitor,
if (!dbus_connection_register_object_path(backend->conn, if (!dbus_connection_register_object_path(backend->conn,
PROFILE_HFP_AG, PROFILE_HFP_AG,
&vtable_profile, backend)) { &vtable_profile, backend)) {
goto fail; goto fail2;
} }
#endif #endif
return backend; return backend;
fail2:
#ifdef HAVE_BLUEZ_5_BACKEND_HSP_NATIVE
dbus_connection_unregister_object_path(backend->conn, PROFILE_HSP_HS);
fail1:
dbus_connection_unregister_object_path(backend->conn, PROFILE_HSP_AG);
#endif
fail: fail:
free(backend); free(backend);
return NULL; return NULL;