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;
        }
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to