mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
bluez: fix a memleak on error
If the allocation failed, our strdup'ed path would leak. Found by scan-build
This commit is contained in:
parent
b64f0d581f
commit
bc64b32798
1 changed files with 6 additions and 2 deletions
|
|
@ -2534,9 +2534,13 @@ static DBusHandlerResult endpoint_set_configuration(DBusConnection *conn,
|
|||
is_new = transport == NULL;
|
||||
|
||||
if (is_new) {
|
||||
transport = spa_bt_transport_create(monitor, strdup(transport_path), 0);
|
||||
if (transport == NULL)
|
||||
char *path = strdup(transport_path);
|
||||
|
||||
transport = spa_bt_transport_create(monitor, path, 0);
|
||||
if (transport == NULL) {
|
||||
free(path);
|
||||
return DBUS_HANDLER_RESULT_NEED_MEMORY;
|
||||
}
|
||||
|
||||
spa_bt_transport_set_implementation(transport, &transport_impl, transport);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue