Due to the uninitialized field before the error path, passing an
invalid iface argument may result in a bad free() call. Initialize
the fields properly beforehand.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
list.list = NULL;
list.count = list.allocated = 0;
list.siface = iface;
+ list.show_all = 0;
+ list.cardname = NULL;
if (strcmp(iface, "card") == 0)
list.iface = SND_CTL_ELEM_IFACE_CARD;
else if (strcmp(iface, "pcm") == 0)
goto __error;
}
- list.show_all = 0;
- list.cardname = NULL;
if (snd_config_search(local_config, "defaults.namehint.showall", &conf) >= 0)
list.show_all = snd_config_get_bool(conf) > 0;
if (card >= 0) {