ucm: fix use after free in if_eval_regex_match()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2021-06-02 19:52:12 +02:00
parent 200d18cda7
commit 9b71d53bde

View file

@ -160,11 +160,12 @@ static int if_eval_regex_match(snd_use_case_mgr_t *uc_mgr, snd_config_t *eval)
if (err < 0)
return err;
err = regcomp(&re, s, options);
free(s);
if (err) {
uc_error("Regex '%s' compilation failed (code %d)", s, err);
free(s);
return -EINVAL;
}
free(s);
err = uc_mgr_get_substituted_value(uc_mgr, &s, string);
if (err < 0) {