summaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb-frontends/cx24117.c
diff options
context:
space:
mode:
authorWenwen Wang <wenwen@cs.uga.edu>2019-08-17 09:04:04 +0200
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-08-21 23:39:54 +0200
commit2f6451ed8b5223a28eab81116dd2f901c0dc9f4a (patch)
tree22c2e04b9bc3b429e2102b82eb4e5af1ea9f278f /drivers/media/dvb-frontends/cx24117.c
parentmedia: dvb-frontends: fix memory leaks (diff)
downloadlinux-2f6451ed8b5223a28eab81116dd2f901c0dc9f4a.tar.xz
linux-2f6451ed8b5223a28eab81116dd2f901c0dc9f4a.zip
media: dvb-frontends: fix a memory leak bug
In cx24117_load_firmware(), 'buf' is allocated through kmalloc() to hold the firmware. However, if i2c_transfer() fails, it is not deallocated, leading to a memory leak bug. Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/dvb-frontends/cx24117.c')
-rw-r--r--drivers/media/dvb-frontends/cx24117.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/media/dvb-frontends/cx24117.c b/drivers/media/dvb-frontends/cx24117.c
index 42697a5999f7..9fccc906d85a 100644
--- a/drivers/media/dvb-frontends/cx24117.c
+++ b/drivers/media/dvb-frontends/cx24117.c
@@ -619,8 +619,10 @@ static int cx24117_load_firmware(struct dvb_frontend *fe,
/* send fw */
ret = i2c_transfer(state->priv->i2c, &msg, 1);
- if (ret < 0)
+ if (ret < 0) {
+ kfree(buf);
return ret;
+ }
kfree(buf);