summaryrefslogtreecommitdiff
path: root/sound/pci/hda
diff options
context:
space:
mode:
authorWenwen Wang <wang6495@umn.edu>2019-04-27 09:06:46 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-06-11 13:23:35 +0300
commit2d8956305ae8529b15e492029c1b50bbfdf30ba5 (patch)
tree5ad17aa4c7bca8037dde816bea4f2af9d14c9a05 /sound/pci/hda
parentb1c1888ad6c930ee7cdc7ca01069027462dfb37f (diff)
downloadlinux-2d8956305ae8529b15e492029c1b50bbfdf30ba5.tar.xz
ALSA: usb-audio: Fix a memory leak bug
commit cb5173594d50c72b7bfa14113dfc5084b4d2f726 upstream. In parse_audio_selector_unit(), the string array 'namelist' is allocated through kmalloc_array(), and each string pointer in this array, i.e., 'namelist[]', is allocated through kmalloc() in the following for loop. Then, a control instance 'kctl' is created by invoking snd_ctl_new1(). If an error occurs during the creation process, the string array 'namelist', including all string pointers in the array 'namelist[]', should be freed, before the error code ENOMEM is returned. However, the current code does not free 'namelist[]', resulting in memory leaks. To fix the above issue, free all string pointers 'namelist[]' in a loop. Signed-off-by: Wenwen Wang <wang6495@umn.edu> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound/pci/hda')
0 files changed, 0 insertions, 0 deletions