mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Jesper Juhl <jesper.juhl@gmail.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	robert.moore@intel.com, len.brown@intel.com
Subject: Re: [PATCH][ACPI] Fix acpi_ev_pci_config_region_setup() to avoid memory leak
Date: Wed, 18 Jul 2007 17:51:26 -0700	[thread overview]
Message-ID: <20070718175126.40d845c5.akpm@linux-foundation.org> (raw)
In-Reply-To: <200707190048.03992.jesper.juhl@gmail.com>

On Thu, 19 Jul 2007 00:48:03 +0200
Jesper Juhl <jesper.juhl@gmail.com> 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 <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);
>  	}
>  

We're supposed to use the attractive ACPI_FREE() here.  I'll make that
change.


      parent reply	other threads:[~2007-07-19  0:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-18 22:48 Jesper Juhl
2007-07-19  0:47 ` Len Brown
2007-07-19  0:51 ` Andrew Morton [this message]

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=20070718175126.40d845c5.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=jesper.juhl@gmail.com \
    --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

Powered by JetHome