* [PATCH] media: dvb-frontends: fix a memory leak bug
@ 2019-08-17 7:04 Wenwen Wang
0 siblings, 0 replies; only message in thread
From: Wenwen Wang @ 2019-08-17 7:04 UTC (permalink / raw)
To: Wenwen Wang
Cc: Mauro Carvalho Chehab, Thomas Gleixner, Richard Fontana,
Greg Kroah-Hartman, Allison Randal,
open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB),
open list
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>
---
drivers/media/dvb-frontends/cx24117.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/media/dvb-frontends/cx24117.c b/drivers/media/dvb-frontends/cx24117.c
index 42697a5..9fccc90 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);
--
2.7.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2019-08-17 7:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-17 7:04 [PATCH] media: dvb-frontends: fix a memory leak bug Wenwen Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).