Commit 1f3b1407 authored by Wei Yongjun's avatar Wei Yongjun Committed by Takashi Iwai

ALSA: fix possible memory leak in snd_mixer_oss_build_input()

uinfo has been allocated in this function and should be
freed before leaving from the error handling cases.

spatch with a semantic match is used to found this problem.
(http://coccinelle.lip6.fr/)
Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent a03e4a66
......@@ -1046,6 +1046,7 @@ static int snd_mixer_oss_build_input(struct snd_mixer_oss *mixer, struct snd_mix
if (kctl->info(kctl, uinfo)) {
up_read(&mixer->card->controls_rwsem);
kfree(uinfo);
return 0;
}
strcpy(str, ptr->name);
......@@ -1061,6 +1062,7 @@ static int snd_mixer_oss_build_input(struct snd_mixer_oss *mixer, struct snd_mix
uinfo->value.enumerated.item = slot.capture_item;
if (kctl->info(kctl, uinfo)) {
up_read(&mixer->card->controls_rwsem);
kfree(uinfo);
return 0;
}
if (!strcmp(uinfo->value.enumerated.name, str)) {
......
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