ucm: fix invalid pointer dereference in parse_open_variables()
Some checks failed
Build alsa-lib / fedora_latest_build (push) Has been cancelled
Build alsa-lib / ubuntu_last_build (push) Has been cancelled

When the string with variables is not parseable, do not
try to free invalid cfg pointer.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2026-02-04 18:43:57 +01:00
parent ebf2efae0a
commit 5414277612

View file

@ -1702,7 +1702,7 @@ const char *parse_open_variables(snd_use_case_mgr_t *uc_mgr, const char *name)
{
const char *end, *id;
char *args, *var;
snd_config_t *cfg, *n;
snd_config_t *cfg = NULL, *n;
snd_config_iterator_t i, next;
char vname[128];
size_t l;
@ -1739,7 +1739,8 @@ const char *parse_open_variables(snd_use_case_mgr_t *uc_mgr, const char *name)
}
skip:
snd_config_delete(cfg);
if (cfg)
snd_config_delete(cfg);
return end + 3;
}