public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH next 1/6] staging: altera-stapl: fix memory leaks
@ 2011-03-10  2:43 Alexander Beregalov
  2011-03-10  2:43 ` [PATCH next 2/6] staging: bcm: " Alexander Beregalov
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Alexander Beregalov @ 2011-03-10  2:43 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel, Alexander Beregalov, Igor M. Liplianin

Free resources before exit.

Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com>
Cc: Igor M. Liplianin <liplianin@netup.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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-03-13 19:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-10  2:43 [PATCH next 1/6] staging: altera-stapl: fix memory leaks Alexander Beregalov
2011-03-10  2:43 ` [PATCH next 2/6] staging: bcm: " Alexander Beregalov
2011-03-11 22:31   ` Greg KH
2011-03-13 19:00     ` Alexander Beregalov
2011-03-10  2:43 ` [PATCH next 3/6] staging: brcm80211: " Alexander Beregalov
2011-03-10  2:43 ` [PATCH next 4/6] staging: crystalhd: " Alexander Beregalov
2011-03-10  2:43 ` [PATCH next 5/6] staging: hv: " Alexander Beregalov
2011-03-10  2:43 ` [PATCH next 6/6] staging: ste_rmi4: " Alexander Beregalov
2011-03-11 22:29 ` [PATCH next 1/6] staging: altera-stapl: " Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox