Re: [PATVH] media, dvb, IX2505V: Remember to free allocated memory in failure path (ix2505v_attach()).

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jesper Juhl
Date: Sunday, January 2, 2011 - 11:49 am

On Fri, 31 Dec 2010, Malcolm Priestley wrote:

[...]

How about this?


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

diff --git a/drivers/media/dvb/frontends/ix2505v.c b/drivers/media/dvb/frontends/ix2505v.c
index 55f2eba..15806e5 100644
--- a/drivers/media/dvb/frontends/ix2505v.c
+++ b/drivers/media/dvb/frontends/ix2505v.c
@@ -271,7 +271,7 @@ struct dvb_frontend *ix2505v_attach(struct dvb_frontend *fe,
 				    const struct ix2505v_config *config,
 				    struct i2c_adapter *i2c)
 {
-	struct ix2505v_state *state = NULL;
+	struct ix2505v_state *state;
 	int ret;
 
 	if (NULL == config) {
@@ -285,6 +285,7 @@ struct dvb_frontend *ix2505v_attach(struct dvb_frontend *fe,
 
 	state->config = config;
 	state->i2c = i2c;
+	fe->tuner_priv = state;
 
 	if (state->config->tuner_write_only) {
 		if (fe->ops.i2c_gate_ctrl)
@@ -301,8 +302,6 @@ struct dvb_frontend *ix2505v_attach(struct dvb_frontend *fe,
 			fe->ops.i2c_gate_ctrl(fe, 0);
 	}
 
-	fe->tuner_priv = state;
-
 	memcpy(&fe->ops.tuner_ops, &ix2505v_tuner_ops,
 		sizeof(struct dvb_tuner_ops));
 	deb_i2c("%s: initialization (%s addr=0x%02x) ok\n",



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

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATVH] media, dvb, IX2505V: Remember to free allocate ..., Malcolm Priestley, (Thu Dec 30, 6:19 pm)
Re: [PATVH] media, dvb, IX2505V: Remember to free allocate ..., Mauro Carvalho Chehab, (Fri Dec 31, 3:30 am)
Re: [PATVH] media, dvb, IX2505V: Remember to free allocate ..., Malcolm Priestley, (Fri Dec 31, 5:21 am)
Re: [PATVH] media, dvb, IX2505V: Remember to free allocate ..., Malcolm Priestley, (Fri Dec 31, 11:33 am)
Re: [PATVH] media, dvb, IX2505V: Remember to free allocate ..., Jesper Juhl, (Sun Jan 2, 11:49 am)