ucm: fix memory leaks detected by the coverity checker

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2019-11-15 12:52:36 +01:00
parent 6fbf87c402
commit 6a76c01a01
2 changed files with 7 additions and 1 deletions

View file

@ -650,8 +650,10 @@ static int parse_value(snd_use_case_mgr_t *uc_mgr ATTRIBUTE_UNUSED,
return -EINVAL;
}
err = uc_mgr_add_value(base, id, s);
if (err < 0)
if (err < 0) {
free(s);
return err;
}
}
return 0;
@ -1761,15 +1763,18 @@ int uc_mgr_scan_master_configs(const char **_list[])
err = snd_config_search(cfg, "Syntax", &c);
if (err < 0) {
uc_error("Syntax field not found in %s", d_name);
snd_config_delete(cfg);
continue;
}
err = snd_config_get_integer(c, &l);
if (err < 0) {
uc_error("Syntax field is invalid in %s", d_name);
snd_config_delete(cfg);
goto __err;
}
if (l < 2 || l > SYNTAX_VERSION_MAX) {
uc_error("Incompatible syntax %d in %s", l, d_name);
snd_config_delete(cfg);
goto __err;
}
err = snd_config_search(cfg, "Comment", &c);

View file

@ -158,6 +158,7 @@ __rval:
if (nsize > size) {
nr = realloc(r, nsize);
if (nr == NULL) {
free(rval);
err = -ENOMEM;
goto __error;
}