Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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)) {