OSDN Git Service

namehint: Fix invalid list access in snd_device_name_hint()
authorTakashi Iwai <tiwai@suse.de>
Thu, 30 Apr 2015 10:26:43 +0000 (12:26 +0200)
committerTakashi Iwai <tiwai@suse.de>
Thu, 30 Apr 2015 10:26:43 +0000 (12:26 +0200)
commitbf98b4e3166c28343429119135644ba70c6e5277
treef22d659855a231d2d5dd1f4ffc4154f4c5c794f2
parentba6fa7b5a6a34da98e05df395f70bba3e2993497
namehint: Fix invalid list access in snd_device_name_hint()

snd_device_name_hint() tries to free the allocated list at the error
path via snd_device_name_free_hint().  But snd_device_name_free_hint()
expects a list terminated by NULL while snd_device_name_hint() doesn't
add it.  Adding it may again result in an error and thus isn't
guaranteed to work.  Hence we can't add NULL at the error path.

Instead, now the code always allocates one entry more, and zero-clears
the newly allocated beforehand to guarantee the NULL termination.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
src/control/namehint.c