[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1390580075-14342-1-git-send-email-hanjun.guo@linaro.org>
Date: Sat, 25 Jan 2014 00:14:35 +0800
From: Hanjun Guo <hanjun.guo@...aro.org>
To: Matthew Garrett <matthew.garrett@...ula.com>
Cc: "Rafael J. Wysocki" <rjw@...ysocki.net>,
linux-acpi@...r.kernel.org, patches@...aro.org,
linux-kernel@...r.kernel.org, linaro-kernel@...ts.linaro.org,
linaro-acpi@...ts.linaro.org, platform-driver-x86@...r.kernel.org,
Hanjun Guo <hanjun.guo@...aro.org>
Subject: [PATCH] Platform / wmi: Fix potential memory leak in parse_wdg()
we forgot to call wmi_free_devices() and free out.pointer
when alloc mamory failed.
Signed-off-by: Hanjun Guo <hanjun.guo@...aro.org>
---
drivers/platform/x86/wmi.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index 43d1329..e1338b5 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -797,8 +797,11 @@ static int parse_wdg(acpi_handle handle)
wmi_dump_wdg(&gblock[i]);
wblock = kzalloc(sizeof(struct wmi_block), GFP_KERNEL);
- if (!wblock)
- return -ENOMEM;
+ if (!wblock) {
+ wmi_free_devices();
+ retval = -ENOMEM;
+ goto out_free_pointer;
+ }
wblock->handle = handle;
wblock->gblock = gblock[i];
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists