bluez5: fix cleanup

Clean up the transport listener and the codec_props on error.
Also clean up when the timerfd allocation fails.
This commit is contained in:
Wim Taymans 2026-05-06 14:03:18 +02:00
parent 7254b8288f
commit 3e53487c72
2 changed files with 16 additions and 5 deletions

View file

@ -2674,7 +2674,7 @@ impl_init(const struct spa_handle_factory *factory,
if ((res = spa_system_timerfd_create(this->data_system,
CLOCK_MONOTONIC, SPA_FD_CLOEXEC | SPA_FD_NONBLOCK)) < 0)
return res;
goto error_remove_listener;
this->timerfd = res;
if ((res = spa_system_timerfd_create(this->data_system,
@ -2702,6 +2702,10 @@ error_close_flush_timerfd:
spa_system_close(this->data_system, this->flush_timerfd);
error_close_timerfd:
spa_system_close(this->data_system, this->timerfd);
error_remove_listener:
spa_hook_remove(&this->transport_listener);
if (this->codec_props && this->codec->clear_props)
this->codec->clear_props(this->codec_props);
return res;
}