UCM: Fix empty get_list - initialize returned pointer to NULL

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2011-03-19 01:09:41 +01:00
parent 60397387ef
commit f2912f5099

View file

@ -75,8 +75,10 @@ static int alloc_str_list(struct list_head *list, int mult, char **result[])
int cnt;
cnt = list_count(list) * mult;
if (cnt == 0)
if (cnt == 0) {
*result = NULL;
return cnt;
}
res = calloc(mult, cnt * sizeof(char *));
if (res == NULL)
return -ENOMEM;
@ -912,8 +914,8 @@ static int get_value_list(snd_use_case_mgr_t *uc_mgr,
goto __fail;
}
err = alloc_str_list(&mylist, 1, &res);
*list = (const char **)res;
if (err >= 0) {
*list = (const char **)res;
list_for_each(pos, &mylist) {
val = list_entry(pos, struct myvalue, list);
*res = strdup(val->value);