* [2.4] Memleak and incorrect return value in emu10k1 emu10k1_audio_open()
@ 2003-03-13 19:13 Oleg Drokin
0 siblings, 0 replies; only message in thread
From: Oleg Drokin @ 2003-03-13 19:13 UTC (permalink / raw)
To: alan, linux-kernel
Hello!
There is trivial memleak ion error exit path and incorrect value returned.
Also seems it is not so bad idea to free allocated RAM before BUG(), too.
See the patch.
Found with help of smatch + enhanced unfree script.
Bye,
Oleg
===== drivers/sound/emu10k1/audio.c 1.13 vs edited =====
--- 1.13/drivers/sound/emu10k1/audio.c Sun May 26 17:49:32 2002
+++ edited/drivers/sound/emu10k1/audio.c Thu Mar 13 22:10:39 2003
@@ -1135,7 +1135,8 @@
if ((wiinst = (struct wiinst *) kmalloc(sizeof(struct wiinst), GFP_KERNEL)) == NULL) {
ERROR();
- return -ENODEV;
+ kfree(wave_dev);
+ return -ENOMEM;
}
wiinst->recsrc = card->wavein.recsrc;
@@ -1161,6 +1162,8 @@
wiinst->format.channels = hweight32(wiinst->fxwc);
break;
default:
+ kfree(wave_dev);
+ kfree(wiinst);
BUG();
break;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-03-13 19:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-13 19:13 [2.4] Memleak and incorrect return value in emu10k1 emu10k1_audio_open() Oleg Drokin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox