public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Renninger <trenn@suse.de>
To: lenb@kernel.org, linux-acpi@vger.kernel.org
Cc: Thomas Renninger <trenn@suse.de>,
	Matthew Garrett <mjg59@srcf.ucam.org>,
	Linux-acpi@vger.kernel.org
Subject: [PATCH 2/3] hp-wmi: Fix memleaks by freeing acpi buffers delcared as ACPI_ALLOCATE_BUFFER
Date: Mon, 26 Oct 2009 17:44:17 +0100	[thread overview]
Message-ID: <1256575458-19269-3-git-send-email-trenn@suse.de> (raw)
In-Reply-To: <1256575458-19269-1-git-send-email-trenn@suse.de>

C: Carlos Corbacho <carlos@strangeworlds.co.uk>
CC: Matthew Garrett <mjg59@srcf.ucam.org>
CC: linux-acpi@vger.kernel.org
CC: Len Brown <lenb@kernel.org>
CC: Linux-acpi@vger.kernel.org

Signed-off-by: Thomas Renninger <trenn@suse.de>
---
 drivers/platform/x86/hp-wmi.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
index c284217..8cea7ff 100644
--- a/drivers/platform/x86/hp-wmi.c
+++ b/drivers/platform/x86/hp-wmi.c
@@ -128,10 +128,15 @@ static int hp_wmi_perform_query(int query, int write, int value)
 
 	obj = output.pointer;
 
-	if (!obj || obj->type != ACPI_TYPE_BUFFER)
+	if (!obj)
 		return -EINVAL;
+	else if (obj->type != ACPI_TYPE_BUFFER) {
+		kfree(output.pointer);
+		return -EINVAL;
+	}
 
 	bios_return = *((struct bios_return *)obj->buffer.pointer);
+	kfree(output.pointer);
 	if (bios_return.return_code > 0)
 		return bios_return.return_code * -1;
 	else
@@ -377,6 +382,9 @@ static void hp_wmi_notify(u32 value, void *context)
 			       eventcode);
 	} else
 		printk(KERN_INFO "HP WMI: Unknown response received\n");
+
+	if(obj)
+		kfree(obj.pointer);
 }
 
 static int __init hp_wmi_input_setup(void)
-- 
1.6.3


  parent reply	other threads:[~2009-10-26 16:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-26 16:44 Introduce msi-wmi driver - Fix hp-wmi memleaks - Cleanup __cpuinit warnings Thomas Renninger
2009-10-26 16:44 ` [PATCH 1/3] X86 drivers: Introduce msi-wmi driver Thomas Renninger
2009-10-26 17:04   ` Matthew Garrett
2009-10-26 21:56     ` Thomas Renninger
2009-10-26 20:10       ` Matthew Garrett
2009-10-26 16:44 ` Thomas Renninger [this message]
2009-12-16 18:03   ` [PATCH 2/3] hp-wmi: Fix memleaks by freeing acpi buffers delcared as ACPI_ALLOCATE_BUFFER Len Brown
2009-12-16 19:20     ` Len Brown
2009-10-26 16:44 ` [PATCH 3/3] ACPI processor: Fix section mismatch for processor_add() Thomas Renninger
2009-12-16 18:15   ` Len Brown

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=1256575458-19269-3-git-send-email-trenn@suse.de \
    --to=trenn@suse.de \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=mjg59@srcf.ucam.org \
    /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