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]
Message-Id: <1299724988-25351-1-git-send-email-a.beregalov@gmail.com>
Date:	Thu, 10 Mar 2011 05:43:03 +0300
From:	Alexander Beregalov <a.beregalov@...il.com>
To:	gregkh@...e.de
Cc:	linux-kernel@...r.kernel.org,
	Alexander Beregalov <a.beregalov@...il.com>,
	"Igor M. Liplianin" <liplianin@...up.ru>
Subject: [PATCH next 1/6] staging: altera-stapl: fix memory leaks

Free resources before exit.

Signed-off-by: Alexander Beregalov <a.beregalov@...il.com>
Cc: Igor M. Liplianin <liplianin@...up.ru>
---
 drivers/staging/altera-stapl/altera.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/altera-stapl/altera.c b/drivers/staging/altera-stapl/altera.c
index 05aad35..fcc7650 100644
--- a/drivers/staging/altera-stapl/altera.c
+++ b/drivers/staging/altera-stapl/altera.c
@@ -2435,11 +2435,16 @@ int altera_init(struct altera_config *config, const struct firmware *fw)
 	if (!key)
 		return -ENOMEM;
 	value = kzalloc(257 * sizeof(char), GFP_KERNEL);
-	if (!value)
+	if (!value) {
+		kfree(key);
 		return -ENOMEM;
+	}
 	astate = kzalloc(sizeof(struct altera_state), GFP_KERNEL);
-	if (!astate)
+	if (!astate) {
+		kfree(value);
+		kfree(key);
 		return -ENOMEM;
+	}
 
 	astate->config = config;
 	if (!astate->config->jtag_io) {
-- 
1.7.4.1

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