RE: Coverity CID 134632: acpi_hw_build_pci_list() memory leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On second thought, did you notice that the caller always deletes the list, regardless of the return status?

    /* Build a list of PCI devices, from PciRegion up to RootPciDevice */

    Status = AcpiHwBuildPciList (RootPciDevice, PciRegion, &ListHead);
    if (ACPI_SUCCESS (Status))
    {
        /* Walk the list, updating the PCI device/function/bus numbers */

        Status = AcpiHwProcessPciList (PciId, ListHead);
    }

    /* Always delete the list */

    AcpiHwDeletePciList (ListHead);
    return_ACPI_STATUS (Status);

> -----Original Message-----
> From: Bjorn Helgaas [mailto:bhelgaas@xxxxxxxxxx]
> Sent: Thursday, April 03, 2014 9:22 AM
> To: Moore, Robert; Zheng, Lv; Wysocki, Rafael J
> Cc: linux-acpi@xxxxxxxxxxxxxxx; devel@xxxxxxxxxx
> Subject: Coverity CID 134632: acpi_hw_build_pci_list() memory leak
> 
> Coverity complains that acpi_hw_build_pci_list() leaks memory when it
> returns here:
> 
> 201                if (!list_element) {
> 
> CID 134632 (#1 of 2): Resource leak (RESOURCE_LEAK) 13. leaked_storage:
> Variable list_head going out of scope leaks the storage it points to.
> 202                        return (AE_NO_MEMORY);
> 203                }
> 
> We're building up a list, and if we fail to allocate another element, we
> return failure without deallocating the already built-up list.
> 
> This is CID 134632.
> 
> Bjorn
��.n��������+%������w��{.n�����{�����ܨ}���Ơz�j:+v�����w����ޙ��&�)ߡ�a����z�ޗ���ݢj��w�f





[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux