[PATCH] PCI: fix memory leak in MMCONFIG error path
authorKonrad Rzeszutek <konradr@redhat.com>
Thu, 15 Jun 2006 16:08:30 +0000 (12:08 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 21 Jun 2006 19:00:01 +0000 (12:00 -0700)
This a bit late (yours patch was posted about a year ago), but
a co-worker of spotted part of the code that looks like a memory
leak. Looking at the code it seems that pci_mmcfg_config should
be free-ed if MMCONFIG is above 4GB.

From: Konrad Rzeszutek <konradr@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/i386/kernel/acpi/boot.c

index 40e5aba3ad3d425f1545ff7e199e1356a56e38d8..fbe93084244c229b67686dec723689b90da18237 100644 (file)
@@ -202,6 +202,8 @@ int __init acpi_parse_mcfg(unsigned long phys_addr, unsigned long size)
                if (mcfg->config[i].base_reserved) {
                        printk(KERN_ERR PREFIX
                               "MMCONFIG not in low 4GB of memory\n");
+                       kfree(pci_mmcfg_config);
+                       pci_mmcfg_config_num = 0;
                        return -ENODEV;
                }
        }