]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
LoongArch: Fix memleak in pci_acpi_scan_root()
authorWentao Guan <guanwentao@uniontech.com>
Tue, 24 Sep 2024 07:32:20 +0000 (15:32 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Tue, 24 Sep 2024 07:32:20 +0000 (15:32 +0800)
Add kfree(root_ops) in this case to avoid memleak of root_ops,
leaks when pci_find_bus() != 0.

Signed-off-by: Yuli Wang <wangyuli@uniontech.com>
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
arch/loongarch/pci/acpi.c

index 365f7de771cbb9e6c72d1d8d0133af476510c2a0..1da4dc46df43e5b77bb0666cb849d00f0443d7f8 100644 (file)
@@ -225,6 +225,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
        if (bus) {
                memcpy(bus->sysdata, info->cfg, sizeof(struct pci_config_window));
                kfree(info);
+               kfree(root_ops);
        } else {
                struct pci_bus *child;