summaryrefslogtreecommitdiffstats
path: root/sound/usb
diff options
context:
space:
mode:
authorRuslan Bilovol <ruslan.bilovol@gmail.com>2018-05-18 01:08:59 +0300
committerTakashi Iwai <tiwai@suse.de>2018-05-18 08:40:40 +0200
commit6cd17ea70b26f66651c7afc123245e379dd14450 (patch)
treee9ad17c7b5c1f35142a8a0638f216247cef0a80e /sound/usb
parent11d42c81036324697d367600bfc16f6dd37636fd (diff)
downloadlinux-stable-6cd17ea70b26f66651c7afc123245e379dd14450.tar.gz
linux-stable-6cd17ea70b26f66651c7afc123245e379dd14450.tar.bz2
linux-stable-6cd17ea70b26f66651c7afc123245e379dd14450.zip
ALSA: usb: stream: fix potential memory leak during uac3 interface parsing
UAC3 channel map is created during interface parsing, and in some cases was not freed in failure paths. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Ruslan Bilovol <ruslan.bilovol@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/stream.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sound/usb/stream.c b/sound/usb/stream.c
index bce315240955..d16e1c23f4e9 100644
--- a/sound/usb/stream.c
+++ b/sound/usb/stream.c
@@ -982,13 +982,16 @@ snd_usb_get_audioformat_uac3(struct snd_usb_audio *chip,
dev_err(&dev->dev, "%u:%d : bogus bTerminalLink %d\n",
iface_no, altno, as->bTerminalLink);
+ kfree(chmap);
return NULL;
found_clock:
fp = audio_format_alloc_init(chip, alts, UAC_VERSION_3, iface_no,
altset_idx, altno, num_channels, clock);
- if (!fp)
+ if (!fp) {
+ kfree(chmap);
return ERR_PTR(-ENOMEM);
+ }
fp->chmap = chmap;
@@ -1009,6 +1012,7 @@ found_clock:
iface_no);
/* ok, let's parse further... */
if (snd_usb_parse_audio_format_v3(chip, fp, as, stream) < 0) {
+ kfree(fp->chmap);
kfree(fp->rate_table);
kfree(fp);
return NULL;