Fix acpi_ev_pci_config_region_setup() to avoid memory leak
PATCH 1/1 Fix acpi_ev_pci_config_region_setup() to avoid memory leak
Hello,
In drivers/acpi/events/evrgnini.c::acpi_ev_pci_config_region_setup() there is a memory leak.
We may return at "if (!pci_device_node)" without freeing storage previously allocated and assigned to 'pci_id'.
This patch fixes the leak by freeing the allocated storage in this case.
Compile tested only...
---
drivers/acpi/events/evrgnini.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/acpi/events/evrgnini.c +1 -0
@@ -284,6 +284,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, }if (!pci_device_node) { +kfree (pci_id);return_ACPI_STATUS (AE_AML_OPERAND_TYPE ); }
Len Brown
reviewerQuoted 1 line · Jesper Juhl
drivers/acpi/events/evrgnini.c
applied (after changing to ACPI_FREE())
thanks,
-Len
Quoted 23 lines · On Thu, 19 Jul 2007 00:48:03 +0200 Jesper Juhl <[email protected]> wrote:
Hello,
In drivers/acpi/events/evrgnini.c::acpi_ev_pci_config_region_setup() there is a memory leak.
We may return at "if (!pci_device_node)" without freeing storage previously allocated and assigned to 'pci_id'.
This patch fixes the leak by freeing the allocated storage in this case.Compile tested only...
Signed-off-by Jesper Juhl <[email protected]>---
drivers/acpi/events/evrgnini.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)drivers/acpi/events/evrgnini.c +0
-0
drivers/acpi/events/evrgnini.c acpi_ev_pci_config_region_setup(acpi_handle handle, · line 290
Quoted 7 lines
drivers/acpi/events/evrgnini.c +1
-0@@ -284,6 +284,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, }if (!pci_device_node) { +kfree (pci_id);return_ACPI_STATUS (AE_AML_OPERAND_TYPE ); }
We're supposed to use the attractive ACPI_FREE() here. I'll make that change.