mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
client-node: handle mix init errors better
Make sure we mark the port invalid when we can't allocate an id for it. Also check that the id does not exceed the max amount of areas we have allocated and release resources correctly.
This commit is contained in:
parent
7e387d842b
commit
3a86ae0276
1 changed files with 8 additions and 1 deletions
|
|
@ -1390,8 +1390,15 @@ static int port_init_mix(void *data, struct pw_impl_port_mix *mix)
|
|||
return -ENOMEM;
|
||||
|
||||
mix->id = pw_map_insert_new(&impl->io_map, NULL);
|
||||
if (mix->id == SPA_ID_INVALID)
|
||||
if (mix->id == SPA_ID_INVALID) {
|
||||
m->valid = false;
|
||||
return -errno;
|
||||
}
|
||||
if (mix->id > MAX_AREAS) {
|
||||
pw_map_remove(&impl->io_map, mix->id);
|
||||
m->valid = false;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
mix->io = SPA_PTROFF(impl->io_areas->map->ptr,
|
||||
mix->id * sizeof(struct spa_io_buffers), void);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue