public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [2.5] memleak in OSS emu10k1 driver in emu10k1_audio_open
@ 2003-03-13 19:17 Oleg Drokin
  0 siblings, 0 replies; only message in thread
From: Oleg Drokin @ 2003-03-13 19:17 UTC (permalink / raw)
  To: torvalds, linux-kernel

Hello!

   There is a memleak on error exit path in OSS emu10k1 driver, also
   incorrect value is returned.
   And it seems to be not that bad idea to free some grabbed mem before BUG(),
   too.
   See the patch.
   Found with help of smatch + enhanced unfree script.

Bye,
    Oleg

===== sound/oss/emu10k1/audio.c 1.13 vs edited =====
--- 1.13/sound/oss/emu10k1/audio.c	Mon Feb 11 05:50:09 2002
+++ edited/sound/oss/emu10k1/audio.c	Thu Mar 13 22:14:40 2003
@@ -1136,7 +1136,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;
@@ -1162,6 +1163,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:07 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:17 [2.5] memleak in OSS emu10k1 driver in 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