mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-03 09:01:52 -05:00
UCM: fix memory leak when executing cset commands
fix memory leak when executing cset commands. snd_ctl_elem's are allocated, but never free'ed Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
e4735ddebd
commit
516569bbba
1 changed files with 10 additions and 1 deletions
|
|
@ -173,7 +173,8 @@ static int execute_cset(snd_ctl_t *ctl, char *cset)
|
||||||
pos = strrchr(cset, ' ');
|
pos = strrchr(cset, ' ');
|
||||||
if (pos == NULL) {
|
if (pos == NULL) {
|
||||||
uc_error("undefined value for cset >%s<", cset);
|
uc_error("undefined value for cset >%s<", cset);
|
||||||
return -EINVAL;
|
err = -EINVAL;
|
||||||
|
goto __fail;
|
||||||
}
|
}
|
||||||
*pos = '\0';
|
*pos = '\0';
|
||||||
err = snd_ctl_ascii_elem_id_parse(id, cset);
|
err = snd_ctl_ascii_elem_id_parse(id, cset);
|
||||||
|
|
@ -196,6 +197,14 @@ static int execute_cset(snd_ctl_t *ctl, char *cset)
|
||||||
err = 0;
|
err = 0;
|
||||||
__fail:
|
__fail:
|
||||||
*pos = ' ';
|
*pos = ' ';
|
||||||
|
|
||||||
|
if (id != NULL)
|
||||||
|
free(id);
|
||||||
|
if (value != NULL)
|
||||||
|
free(value);
|
||||||
|
if (info != NULL)
|
||||||
|
free(info);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue