diff options
author | Colin Ian King <colin.king@canonical.com> | 2018-03-27 15:30:01 +0100 |
---|---|---|
committer | Thierry Strudel <tstrudel@google.com> | 2018-04-06 18:29:29 +0000 |
commit | dd686e498797d32f3505f8460b24cc6e3e4495c6 (patch) | |
tree | a129fcd9689178b943624f0c351d9fe3f17a735f | |
parent | f5a8f755ca56c6dd41ca1e9d34a5f9f977e485a9 (diff) |
FROMLIST: ALSA: usb-audio: fix memory leak on cvalandroid-p-preview-2_r0.1
With the current exit return path of the ctl_info allocation failure
cval is not being freed resulting in a memory leak. Fix this by kfree'ing
it on the return.
Detected by CoverityScan, CID#1466878 ("Resource Leak")
am from commit 623760257b39 ("ALSA: usb-audio: fix memory leak on cval")
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
Change-Id: I500045647e3a926fb0d72620f9420656585a7171
Fixes: 21e9b3e931f7 ("ALSA: usb-audio: fix uac control query argument")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/usb/mixer.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index f063623f899e..9627c22fdc3f 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c @@ -1283,8 +1283,10 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc, cval->control = control; cval->cmask = ctl_mask; ctl_info = get_feature_control_info(control); - if (!ctl_info) + if (!ctl_info) { + kfree(cval); return; + } cval->val_type = ctl_info->type; if (ctl_mask == 0) { cval->channels = 1; /* master channel */ |