public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATVH] media, dvb, IX2505V: Remember to free allocated memory in failure path (ix2505v_attach()).
@ 2010-12-30 23:11 Jesper Juhl
  2010-12-31 10:30 ` Mauro Carvalho Chehab
       [not found] ` <1293758374.10326.7.camel@tvboxspy>
  0 siblings, 2 replies; 6+ messages in thread
From: Jesper Juhl @ 2010-12-30 23:11 UTC (permalink / raw)
  To: linux-media; +Cc: linux-kernel, Mauro Carvalho Chehab, Malcolm Priestley

Hi,

We may leak the storage allocated to 'state' in 
drivers/media/dvb/frontends/ix2505v.c::ix2505v_attach() on error.
This patch makes sure we free the allocated memory in the failure case.


Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 ix2505v.c |    1 +
 1 file changed, 1 insertion(+)

  Compile tested only.

diff --git a/drivers/media/dvb/frontends/ix2505v.c b/drivers/media/dvb/frontends/ix2505v.c
index 55f2eba..fcb173d 100644
--- a/drivers/media/dvb/frontends/ix2505v.c
+++ b/drivers/media/dvb/frontends/ix2505v.c
@@ -293,6 +293,7 @@ struct dvb_frontend *ix2505v_attach(struct dvb_frontend *fe,
 		ret = ix2505v_read_status_reg(state);
 
 		if (ret & 0x80) {
+			kfree(state);
 			deb_i2c("%s: No IX2505V found\n", __func__);
 			goto error;
 		}



-- 
Jesper Juhl <jj@chaosbits.net>            http://www.chaosbits.net/
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please.


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

end of thread, other threads:[~2011-01-02 19:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-30 23:11 [PATVH] media, dvb, IX2505V: Remember to free allocated memory in failure path (ix2505v_attach()) Jesper Juhl
2010-12-31 10:30 ` Mauro Carvalho Chehab
2010-12-31 12:21   ` Malcolm Priestley
     [not found] ` <1293758374.10326.7.camel@tvboxspy>
     [not found]   ` <alpine.LNX.2.00.1012311541430.16655@swampdragon.chaosbits.net>
2010-12-31 18:33     ` Malcolm Priestley
2011-01-02 18:49       ` Jesper Juhl
2011-01-02 19:14         ` Jesper Juhl

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