Skip to content

Commit

Permalink
[media] DVB, DiB9000: Fix leak in dib9000_attach()
Browse files Browse the repository at this point in the history
If the second memory allocation in dib9000_attach() fails, we'll leak the
memory allocated by the first.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Cc: Patrick Boettcher <patrick.boettcher@dibcom.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Jesper Juhl authored and Mauro Carvalho Chehab committed May 20, 2011
1 parent b7101de commit 451a51b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/media/dvb/frontends/dib9000.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 451a51b

Please sign in to comment.