mirror of
https://gitlab.freedesktop.org/pipewire/pipewire
synced 2024-07-21 10:16:14 +00:00
spa: bluez: backend-native: fix a memory leak
In `_transport_create()`, if `spa_bt_transport_create()` failed then `pathfd` would be leaked.
This commit is contained in:
parent
2efccb3d01
commit
4a555ed6ff
|
@ -216,8 +216,10 @@ static struct spa_bt_transport *_transport_create(struct rfcomm *rfcomm)
|
|||
return NULL;
|
||||
|
||||
t = spa_bt_transport_create(backend->monitor, pathfd, sizeof(struct transport_data));
|
||||
if (t == NULL)
|
||||
goto finish;
|
||||
if (t == NULL) {
|
||||
free(pathfd);
|
||||
return NULL;
|
||||
}
|
||||
spa_bt_transport_set_implementation(t, &sco_transport_impl, t);
|
||||
|
||||
t->device = rfcomm->device;
|
||||
|
@ -248,7 +250,6 @@ static struct spa_bt_transport *_transport_create(struct rfcomm *rfcomm)
|
|||
|
||||
spa_bt_transport_add_listener(t, &rfcomm->transport_listener, &transport_events, rfcomm);
|
||||
|
||||
finish:
|
||||
return t;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue