Skip to content

Commit a670602

Browse files
wenwenwang1tiwai
authored andcommitted
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: 7edf3b5 ("ALSA: usb-audio: AudioStreaming Power Domain parsing") Signed-off-by: Wenwen Wang <[email protected]> Cc: <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
1 parent d1d0330 commit a670602

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

sound/usb/stream.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,6 +1043,7 @@ snd_usb_get_audioformat_uac3(struct snd_usb_audio *chip,
10431043

10441044
pd = kzalloc(sizeof(*pd), GFP_KERNEL);
10451045
if (!pd) {
1046+
kfree(fp->chmap);
10461047
kfree(fp->rate_table);
10471048
kfree(fp);
10481049
return NULL;

0 commit comments

Comments
 (0)