public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jesper Juhl <jesper.juhl@gmail.com>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: robert.moore@intel.com, len.brown@intel.com,
	akpm@linux-foundation.org, jesper.juhl@gmail.com
Subject: [PATCH][ACPI] Fix acpi_ev_pci_config_region_setup() to avoid memory leak
Date: Thu, 19 Jul 2007 00:48:03 +0200	[thread overview]
Message-ID: <200707190048.03992.jesper.juhl@gmail.com> (raw)

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);
 	}
 



             reply	other threads:[~2007-07-18 22:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-18 22:48 Jesper Juhl [this message]
2007-07-19  0:47 ` [PATCH][ACPI] Fix acpi_ev_pci_config_region_setup() to avoid memory leak Len Brown
2007-07-19  0:51 ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200707190048.03992.jesper.juhl@gmail.com \
    --to=jesper.juhl@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robert.moore@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox