mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
client-node: free port io memmap also if port gone
clear_port() clears all struct mix and removes the port, and can occur before port io is set to NULL. In this case the port memmaps are not freed, and are leaked until client pool closes. Fix by freeing the old io memmap when setting io to NULL, also when the port was already cleared, so that the memmap lifecycle is the same as that of the IO.
This commit is contained in:
parent
cc0f7596d6
commit
a9911f68a0
1 changed files with 11 additions and 7 deletions
|
|
@ -692,15 +692,19 @@ static int do_port_set_io(struct impl *impl,
|
|||
direction == SPA_DIRECTION_INPUT ? "input" : "output",
|
||||
port_id, mix_id, data, size);
|
||||
|
||||
port = GET_PORT(impl, direction, port_id);
|
||||
if (port == NULL)
|
||||
return data == NULL ? 0 : -EINVAL;
|
||||
|
||||
if ((mix = find_mix(port, mix_id)) == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
old = pw_mempool_find_tag(impl->client_pool, tag, sizeof(tag));
|
||||
|
||||
port = GET_PORT(impl, direction, port_id);
|
||||
if (port == NULL) {
|
||||
pw_memmap_free(old);
|
||||
return data == NULL ? 0 : -EINVAL;
|
||||
}
|
||||
|
||||
if ((mix = find_mix(port, mix_id)) == NULL) {
|
||||
pw_memmap_free(old);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (data) {
|
||||
mm = pw_mempool_import_map(impl->client_pool,
|
||||
impl->context_pool, data, size, tag);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue