drivers/char/ipmi/ipmi_si_intf.c:default_find_bmc(): fix leak
authorAndrew Morton <akpm@linux-foundation.org>
Wed, 20 Aug 2008 21:09:14 +0000 (14:09 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
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 <danielm77@spray.se>
Cc: Christian Krafft <krafft@de.ibm.com>
Cc: Michael Ellerman <michael@ellerman.id.au>
Cc: Corey Minyard <minyard@acm.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/char/ipmi/ipmi_si_intf.c

index f52931e..8e8afb6 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;