public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Fix the memory leak Intel RNG driver for 2.6.21-rc7-mm1
@ 2007-04-26  6:27 Tomita, Haruo
  2007-04-28  7:19 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Tomita, Haruo @ 2007-04-26  6:27 UTC (permalink / raw)
  To: prarit, jbeulich; +Cc: lkml, Tomita, Haruo

This patch fixes a memory leak in mod_init().
In the error, intel_rng_hw was freed.

 intel-rng.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- linux-2.6.21-rc7-mm1/drivers/char/hw_random/intel-rng.c.orig	2007-04-26 11:56:03.000000000 +0900
+++ linux-2.6.21-rc7-mm1/drivers/char/hw_random/intel-rng.c	2007-04-26 13:39:50.000000000 +0900
@@ -345,11 +345,11 @@ static int __init mod_init(void)
 	}
 
 	err = intel_init_hw_struct(intel_rng_hw, dev);
-	if (err == -ENODEV) {
-		pci_dev_put(dev);
-		goto fwh_done;
-	} else if (err < 0) {
+	if (err) {
 		pci_dev_put(dev);
+		kfree(intel_rng_hw);
+		if (err == -ENODEV) 
+			goto fwh_done;
 		goto out;
 	}

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-05-02 16:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-26  6:27 [PATCH 1/2] Fix the memory leak Intel RNG driver for 2.6.21-rc7-mm1 Tomita, Haruo
2007-04-28  7:19 ` Andrew Morton
2007-04-30 11:41   ` Prarit Bhargava
2007-05-02 16:20   ` Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox