public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH][ACPI] Fix acpi_ev_pci_config_region_setup() to avoid memory leak
@ 2007-07-18 22:48 Jesper Juhl
  2007-07-19  0:47 ` Len Brown
  2007-07-19  0:51 ` Andrew Morton
  0 siblings, 2 replies; 3+ messages in thread
From: Jesper Juhl @ 2007-07-18 22:48 UTC (permalink / raw)
  To: Linux Kernel Mailing List; +Cc: robert.moore, len.brown, akpm, jesper.juhl

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 <jesper.juhl@gmail.com>
---

 drivers/acpi/events/evrgnini.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/acpi/events/evrgnini.c b/drivers/acpi/events/evrgnini.c
index 400d90f..10f378b 100644
--- a/drivers/acpi/events/evrgnini.c
+++ b/drivers/acpi/events/evrgnini.c
@@ -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);
 	}
 



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-07-19  0:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-18 22:48 [PATCH][ACPI] Fix acpi_ev_pci_config_region_setup() to avoid memory leak Jesper Juhl
2007-07-19  0:47 ` Len Brown
2007-07-19  0:51 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox