summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorWenwen Wang2019-08-06 09:00:27 +0200
committerGreg Kroah-Hartman2019-08-16 10:12:50 +0200
commitd4d904e4e258e1e5c794af3e702d6f6ecc8fd56d (patch)
tree72156589d782e91d75f615bbbcd1e97195782c1e /sound
parentx86/purgatory: Do not use __builtin_memcpy and __builtin_memset (diff)
downloadkernel-qcow2-linux-d4d904e4e258e1e5c794af3e702d6f6ecc8fd56d.tar.gz
kernel-qcow2-linux-d4d904e4e258e1e5c794af3e702d6f6ecc8fd56d.tar.xz
kernel-qcow2-linux-d4d904e4e258e1e5c794af3e702d6f6ecc8fd56d.zip
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: 7edf3b5e6a45 ("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/usb/stream.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sound/usb/stream.c b/sound/usb/stream.c
index d9e3de495c16..bc582202bd10 100644
--- a/sound/usb/stream.c
+++ b/sound/usb/stream.c
@@ -1053,6 +1053,7 @@ found_clock:
pd = kzalloc(sizeof(*pd), GFP_KERNEL);
if (!pd) {
+ kfree(fp->chmap);
kfree(fp->rate_table);
kfree(fp);
return NULL;