[PATCH] Platform / wmi: Fix potential memory leak in parse_wdg()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



we forgot to call wmi_free_devices() and free out.pointer
when alloc mamory failed.

Signed-off-by: Hanjun Guo <hanjun.guo@xxxxxxxxxx>
---
 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-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux