ucm: split conf_file_name and conf_dir_name

With ucm2, the file name might differ from the directory
name. Also, allocate those fields.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2020-01-15 10:31:56 +01:00
parent b34715004f
commit fe6425af75
5 changed files with 37 additions and 17 deletions

View file

@ -1700,12 +1700,13 @@ int snd_use_case_get(snd_use_case_mgr_t *uc_mgr,
err = 0;
} else if (strcmp(identifier, "_file") == 0) {
/* get the conf file name of the opened card */
if ((uc_mgr->card_name == NULL)
|| (uc_mgr->conf_file_name[0] == '\0')) {
if ((uc_mgr->card_name == NULL) ||
(uc_mgr->conf_file_name == NULL) ||
(uc_mgr->conf_file_name[0] == '\0')) {
err = -ENOENT;
goto __end;
}
*value = strndup(uc_mgr->conf_file_name, MAX_FILE);
*value = strdup(uc_mgr->conf_file_name);
if (*value == NULL) {
err = -ENOMEM;
goto __end;