summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2018-03-27 15:30:01 +0100
committerTakashi Iwai <tiwai@suse.de>2018-03-27 17:45:33 +0200
commit623760257b39632ffc5051fc88167b546dcfa791 (patch)
tree3e4955b7b0da1e0b323b3c55e36ebe8af9a47bc7 /sound
parentf6d297df4dd47ef949540e4a201230d0c5308325 (diff)
ALSA: usb-audio: fix memory leak on cval
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") 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>
Diffstat (limited to 'sound')
-rw-r--r--sound/usb/mixer.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 04dab6f65535..301ad61ed426 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -1365,8 +1365,10 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
cval->cmask = ctl_mask;
ctl_info = get_feature_control_info(control);
- if (!ctl_info)
+ if (!ctl_info) {
+ kfree(cval);
return;
+ }
if (state->mixer->protocol == UAC_VERSION_1)
cval->val_type = ctl_info->type;
else /* UAC_VERSION_2 */