alloc_str_list() sets the result to NULL too, so this patch
makes the behavior more consistent. This also fixes a crash
in PulseAudio, because PulseAudio assumes that
snd_use_case_get_list() always initializes the result, and
since snd_use_case_get_list() uses get_list20(), this
assumption didn't hold.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
char *ptr, *str1;
cnt = alloc_str_list(list, 1, &res);
- if (cnt <= 0)
+ if (cnt <= 0) {
+ *result = NULL;
return cnt;
+ }
*result = (const char **)res;
list_for_each(pos, list) {
ptr = list_entry_offset(pos, char, offset);
char *ptr, *str1, *str2;
cnt = alloc_str_list(list, 2, &res);
- if (cnt <= 0)
+ if (cnt <= 0) {
+ *result = NULL;
return cnt;
+ }
*result = (const char **)res;
list_for_each(pos, list) {
ptr = list_entry_offset(pos, char, offset);