Re: [PATCH] ALSA: usb-audio: fix a memory leak bug

2019-08-06 Thread Takashi Iwai
On Tue, 06 Aug 2019 09:00:27 +0200, Wenwen Wang wrote: > > In snd_usb_get_audioformat_uac3(), a structure for channel maps 'chmap' is > allocated through kzalloc() before the execution goto 'found_clock'. > However, this structure is not deallocated if the memory allocation for > 'pd' fails,

[PATCH] ALSA: usb-audio: fix a memory leak bug

2019-08-06 Thread Wenwen Wang
In snd_usb_get_audioformat_uac3(), a structure for channel maps 'chmap' is allocated through kzalloc() before the execution goto 'found_clock'. However, this structure is not deallocated if the memory allocation for 'pd' fails, leading to a memory leak bug. To fix the above issue, free

Re: [PATCH] ALSA: usb-audio: fix a memory leak bug

2019-08-06 Thread Takashi Iwai
On Tue, 06 Aug 2019 08:13:06 +0200, Wenwen Wang wrote: > > In add_new_ctl(), a mixer element structure is allocated through kzalloc() > and the pointer is saved to 'elem'. Later on, a new alsa control element is > created and added to this structure. In case the add process fails, i.e., > the

[PATCH] ALSA: usb-audio: fix a memory leak bug

2019-08-06 Thread Wenwen Wang
In add_new_ctl(), a mixer element structure is allocated through kzalloc() and the pointer is saved to 'elem'. Later on, a new alsa control element is created and added to this structure. In case the add process fails, i.e., the return value of snd_usb_mixer_add_control() is less than 0, the

Re: [PATCH] ALSA: usb-audio: Fix a memory leak bug

2019-04-28 Thread Takashi Iwai
On Sat, 27 Apr 2019 08:06:46 +0200, Wenwen Wang wrote: > > 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

[PATCH] ALSA: usb-audio: Fix a memory leak bug

2019-04-27 Thread Wenwen Wang
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