lkml.org 
[lkml]   [2011]   [Mar]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH next 1/6] staging: altera-stapl: fix memory leaks
Date
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


\
 
 \ /
  Last update: 2011-03-10 03:45    [W:0.142 / U:0.112 seconds]
©2003-2014 Jasper Spaans. Advertise on this site