summaryrefslogtreecommitdiff
path: root/drivers/media/dvb-frontends/helene.c
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2016-08-13 15:16:54 -0300
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-08-24 16:54:54 -0300
commitfd3223966cac9e6c3751b43c500963e9c71356f0 (patch)
tree1178bece46366c09120506f77163eced6ab13811 /drivers/media/dvb-frontends/helene.c
parent5e015c0e6d1e83bff625f2596d8e123f616002fe (diff)
[media] helene: fix memory leak when heleno_x_pon fails
The error return path of failed calls to heleno_x_pon leak memory because priv is not kfree'd. Fix this by kfree'ing priv before returning. Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/dvb-frontends/helene.c')
-rw-r--r--drivers/media/dvb-frontends/helene.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/media/dvb-frontends/helene.c b/drivers/media/dvb-frontends/helene.c
index 97a8982740a6..3d1cd5fa4904 100644
--- a/drivers/media/dvb-frontends/helene.c
+++ b/drivers/media/dvb-frontends/helene.c
@@ -987,8 +987,10 @@ struct dvb_frontend *helene_attach_s(struct dvb_frontend *fe,
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 1);
- if (helene_x_pon(priv) != 0)
+ if (helene_x_pon(priv) != 0) {
+ kfree(priv);
return NULL;
+ }
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 0);
@@ -1021,8 +1023,10 @@ struct dvb_frontend *helene_attach(struct dvb_frontend *fe,
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 1);
- if (helene_x_pon(priv) != 0)
+ if (helene_x_pon(priv) != 0) {
+ kfree(priv);
return NULL;
+ }
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 0);