Commit 2f6451ed authored by Wenwen Wang's avatar Wenwen Wang Committed by Mauro Carvalho Chehab

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: default avatarWenwen Wang <wenwen@cs.uga.edu>
Signed-off-by: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 8c3d3cdb
...@@ -619,8 +619,10 @@ static int cx24117_load_firmware(struct dvb_frontend *fe, ...@@ -619,8 +619,10 @@ static int cx24117_load_firmware(struct dvb_frontend *fe,
/* send fw */ /* send fw */
ret = i2c_transfer(state->priv->i2c, &msg, 1); ret = i2c_transfer(state->priv->i2c, &msg, 1);
if (ret < 0) if (ret < 0) {
kfree(buf);
return ret; return ret;
}
kfree(buf); kfree(buf);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment