lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Sat,  9 Jan 2010 17:46:35 +0300
From:	Alexander Beregalov <a.beregalov@...il.com>
To:	torvalds@...ux-foundation.org, linux-kernel@...r.kernel.org
Cc:	Alexander Beregalov <a.beregalov@...il.com>
Subject: [PATCH] kernel/resource.c: fix memory leak

Free res before exit.
Found by cppcheck.

Signed-off-by: Alexander Beregalov <a.beregalov@...il.com>
---
 kernel/resource.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/kernel/resource.c b/kernel/resource.c
index af96c1e..ae2e177 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -545,11 +545,12 @@ static void __init __reserve_region_with_split(struct resource *root,
 	res->flags = IORESOURCE_BUSY;
 
 	conflict = __request_resource(parent, res);
+	kfree(res);
+
 	if (!conflict)
 		return;
 
 	/* failed, split and try again */
-	kfree(res);
 
 	/* conflict covered whole area */
 	if (conflict->start <= start && conflict->end >= end)
-- 
1.6.6

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ