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: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
a03e4a66c7
commit
1f3b14072b
|
@ -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)) {
|
||||
|
|
Loading…
Reference in New Issue