ALSA: usb-audio: fix a memory leak bug
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 'fp->chmap' before returning NULL.
Fixes: 7edf3b5e6a
("ALSA: usb-audio: AudioStreaming Power Domain parsing")
Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
d1d0330665
commit
a67060201b
@ -1043,6 +1043,7 @@ found_clock:
|
|||||||
|
|
||||||
pd = kzalloc(sizeof(*pd), GFP_KERNEL);
|
pd = kzalloc(sizeof(*pd), GFP_KERNEL);
|
||||||
if (!pd) {
|
if (!pd) {
|
||||||
|
kfree(fp->chmap);
|
||||||
kfree(fp->rate_table);
|
kfree(fp->rate_table);
|
||||||
kfree(fp);
|
kfree(fp);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user