drivers/char/ipmi/ipmi_si_intf.c:default_find_bmc(): fix leak
authorAndrew Morton <[email protected]>
Wed, 20 Aug 2008 21:09:14 +0000 (14:09 -0700)
committerLinus Torvalds <[email protected]>
Wed, 20 Aug 2008 22:40:31 +0000 (15:40 -0700)
If check_legacy_ioport() returns true, we leak *info.

Addresses http://bugzilla.kernel.org/show_bug.cgi?id=11362

Reported-by: Daniel Marjamki <[email protected]>
Cc: Christian Krafft <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: Corey Minyard <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
drivers/char/ipmi/ipmi_si_intf.c

index f52931e1c16eb08d0d353a92836a6fdfe0060268..8e8afb6141f99edc8f3a38bbcad1e1b9e802961f 100644 (file)
@@ -2695,15 +2695,13 @@ static __devinit void default_find_bmc(void)
        for (i = 0; ; i++) {
                if (!ipmi_defaults[i].port)
                        break;
-
-               info = kzalloc(sizeof(*info), GFP_KERNEL);
-               if (!info)
-                       return;
-
 #ifdef CONFIG_PPC_MERGE
                if (check_legacy_ioport(ipmi_defaults[i].port))
                        continue;
 #endif
+               info = kzalloc(sizeof(*info), GFP_KERNEL);
+               if (!info)
+                       return;
 
                info->addr_source = NULL;