ucm: fix few memory-leaks in the error paths

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2022-07-08 21:56:57 +02:00
parent 378c6a9215
commit fc86eafa08
2 changed files with 6 additions and 6 deletions

View file

@ -1481,8 +1481,8 @@ const char *parse_open_variables(snd_use_case_mgr_t *uc_mgr, const char *name)
goto skip;
}
snd_config_delete(cfg);
skip:
snd_config_delete(cfg);
return end + 3;
}

View file

@ -415,15 +415,15 @@ static int evaluate_macro1(snd_use_case_mgr_t *uc_mgr,
n = snd_config_iterator_entry(i);
err = snd_config_get_id(n, &id);
if (err < 0)
return err;
goto __err_path;
err = snd_config_get_ascii(n, &var);
if (err < 0)
return err;
goto __err_path;
snprintf(name, sizeof(name), "__%s", id);
err = uc_mgr_set_variable(uc_mgr, name, var);
free(var);
if (err < 0)
return err;
goto __err_path;
}
/* merge + substitute variables */
@ -443,11 +443,11 @@ static int evaluate_macro1(snd_use_case_mgr_t *uc_mgr,
n = snd_config_iterator_entry(i);
err = snd_config_get_id(n, &id);
if (err < 0)
return err;
goto __err_path;
snprintf(name, sizeof(name), "__%s", id);
err = uc_mgr_delete_variable(uc_mgr, name);
if (err < 0)
return err;
goto __err_path;
}
__err_path: