Commit 62376025 authored by Colin Ian King's avatar Colin Ian King Committed by Takashi Iwai

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: 21e9b3e9 ("ALSA: usb-audio: fix uac control query argument")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent f6d297df
...@@ -1365,8 +1365,10 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc, ...@@ -1365,8 +1365,10 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
cval->cmask = ctl_mask; cval->cmask = ctl_mask;
ctl_info = get_feature_control_info(control); ctl_info = get_feature_control_info(control);
if (!ctl_info) if (!ctl_info) {
kfree(cval);
return; return;
}
if (state->mixer->protocol == UAC_VERSION_1) if (state->mixer->protocol == UAC_VERSION_1)
cval->val_type = ctl_info->type; cval->val_type = ctl_info->type;
else /* UAC_VERSION_2 */ else /* UAC_VERSION_2 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment