linux-stable/sound/usb/hiface
Wenwen Wang 1c286e4e13 ALSA: hiface: fix multiple memory leak bugs
commit 3d92aa45fb upstream.

In hiface_pcm_init(), 'rt' is firstly allocated through kzalloc(). Later
on, hiface_pcm_init_urb() is invoked to initialize 'rt->out_urbs[i]'. In
hiface_pcm_init_urb(), 'rt->out_urbs[i].buffer' is allocated through
kzalloc().  However, if hiface_pcm_init_urb() fails, both 'rt' and
'rt->out_urbs[i].buffer' are not deallocated, leading to memory leak bugs.
Also, 'rt->out_urbs[i].buffer' is not deallocated if snd_pcm_new() fails.

To fix the above issues, free 'rt' and 'rt->out_urbs[i].buffer'.

Fixes: a91c3fb2f8 ("Add M2Tech hiFace USB-SPDIF driver")
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>
2019-08-16 10:12:51 +02:00
..
chip.c ALSA: usb: Convert to snd_card_new() with a device pointer 2014-02-12 11:18:00 +01:00
chip.h
Makefile
pcm.c ALSA: hiface: fix multiple memory leak bugs 2019-08-16 10:12:51 +02:00
pcm.h