Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1462121
| Path | csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Colin King <colin.king@canonical.com> |
| Newsgroups | linux.kernel |
| Subject | [PATCH] helene: fix memory leak when heleno_x_pon fails |
| Date | Sun, 14 Aug 2016 15:00:02 +0200 |
| Message-ID | <s5YXT-5oj-5@gated-at.bofh.it> (permalink) |
| X-Original-To | Abylay Ospan <aospan@netup.ru>, Mauro Carvalho Chehab <mchehab@kernel.org>, linux-media@vger.kernel.org |
| X-Mailer | git-send-email 2.8.1 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 41 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | linux-kernel@vger.kernel.org |
| X-Original-Date | Sat, 13 Aug 2016 19:16:54 +0100 |
| X-Original-Message-ID | <1471112214-19547-1-git-send-email-colin.king@canonical.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1462121 |
Show key headers only | View raw
From: Colin Ian King <colin.king@canonical.com>
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>
---
drivers/media/dvb-frontends/helene.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/media/dvb-frontends/helene.c b/drivers/media/dvb-frontends/helene.c
index 97a8982..3d1cd5f 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);
--
2.8.1
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH] helene: fix memory leak when heleno_x_pon fails Colin King <colin.king@canonical.com> - 2016-08-14 15:00 +0200
csiph-web