Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d4d904e4 authored by Wenwen Wang's avatar Wenwen Wang Committed by Greg Kroah-Hartman
Browse files

ALSA: usb-audio: fix a memory leak bug



commit a67060201b746a308b1674f66bf289c9faef6d09 upstream.

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: 7edf3b5e ("ALSA: usb-audio: AudioStreaming Power Domain parsing")
Signed-off-by: default avatarWenwen Wang <wenwen@cs.uga.edu>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e0d262a5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1053,6 +1053,7 @@ snd_usb_get_audioformat_uac3(struct snd_usb_audio *chip,

		pd = kzalloc(sizeof(*pd), GFP_KERNEL);
		if (!pd) {
			kfree(fp->chmap);
			kfree(fp->rate_table);
			kfree(fp);
			return NULL;