mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
alsa-pcm: check if bound ctls are valid before using it.
When bound_ctl info cannot be read this array elem info is set to NULL in 'fetch_bind_ctl'. So when we iterate the bound_ctl array we always have to check this.
This commit is contained in:
parent
45758ecb68
commit
898f854ca7
1 changed files with 7 additions and 0 deletions
|
|
@ -489,6 +489,10 @@ static void add_bind_ctl_params(struct state *state, struct spa_pod_builder *b)
|
|||
int err;
|
||||
|
||||
for (unsigned int i = 0; i < state->num_bind_ctls; i++) {
|
||||
|
||||
if(!state->bound_ctls[i].value || !state->bound_ctls[i].info)
|
||||
continue;
|
||||
|
||||
err = snd_ctl_elem_read(state->ctl, state->bound_ctls[i].value);
|
||||
if (err < 0) {
|
||||
spa_log_warn(state->log, "Could not read elem value for '%s': %s",
|
||||
|
|
@ -699,6 +703,9 @@ static void bind_ctl_event(struct spa_source *source)
|
|||
for (unsigned int i = 0; i < state->num_bind_ctls; i++) {
|
||||
int err;
|
||||
|
||||
if(!state->bound_ctls[i].value || !state->bound_ctls[i].info)
|
||||
continue;
|
||||
|
||||
// Check if we have the right element
|
||||
snd_ctl_elem_value_get_id(state->bound_ctls[i].value, bound_id);
|
||||
if (snd_ctl_elem_id_compare_set(id, bound_id) ||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue