提交 451a51b2 编写于 作者: J Jesper Juhl 提交者: Mauro Carvalho Chehab

[media] DVB, DiB9000: Fix leak in dib9000_attach()

If the second memory allocation in dib9000_attach() fails, we'll leak the
memory allocated by the first.
Signed-off-by: NJesper Juhl <jj@chaosbits.net>
Cc: Patrick Boettcher <patrick.boettcher@dibcom.fr>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 b7101de3
......@@ -2255,8 +2255,10 @@ struct dvb_frontend *dib9000_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, c
if (st == NULL)
return NULL;
fe = kzalloc(sizeof(struct dvb_frontend), GFP_KERNEL);
if (fe == NULL)
if (fe == NULL) {
kfree(st);
return NULL;
}
memcpy(&st->chip.d9.cfg, cfg, sizeof(struct dib9000_config));
st->i2c.i2c_adap = i2c_adap;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册