* [PATCH] staging: altera-stapl: fix memory leaks
@ 2011-03-13 18:52 Alexander Beregalov
0 siblings, 0 replies; only message in thread
From: Alexander Beregalov @ 2011-03-13 18:52 UTC (permalink / raw)
To: mchehab; +Cc: linux-kernel, Alexander Beregalov
Free resources before exit.
Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com>
---
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 [flat|nested] only message in thread
only message in thread, other threads:[~2011-03-13 18:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-13 18:52 [PATCH] staging: altera-stapl: fix memory leaks Alexander Beregalov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®