diff options
author | Jesper Juhl <jj@chaosbits.net> | 2011-04-07 15:34:30 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-05-20 08:28:45 -0400 |
commit | 451a51b218df9a3a93af9fd71a356cc6043df52a (patch) | |
tree | 4d950aacb2800d5166c193511ed200c5a9e317a0 /drivers/media/dvb/frontends | |
parent | b7101de3fff596b35e45cd9fb7007caa07e97c9a (diff) |
[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: Jesper Juhl <jj@chaosbits.net>
Cc: Patrick Boettcher <patrick.boettcher@dibcom.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/frontends')
-rw-r--r-- | drivers/media/dvb/frontends/dib9000.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/media/dvb/frontends/dib9000.c b/drivers/media/dvb/frontends/dib9000.c index 91518761a2da..b25ef2bb5078 100644 --- a/drivers/media/dvb/frontends/dib9000.c +++ b/drivers/media/dvb/frontends/dib9000.c | |||
@@ -2255,8 +2255,10 @@ struct dvb_frontend *dib9000_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, c | |||
2255 | if (st == NULL) | 2255 | if (st == NULL) |
2256 | return NULL; | 2256 | return NULL; |
2257 | fe = kzalloc(sizeof(struct dvb_frontend), GFP_KERNEL); | 2257 | fe = kzalloc(sizeof(struct dvb_frontend), GFP_KERNEL); |
2258 | if (fe == NULL) | 2258 | if (fe == NULL) { |
2259 | kfree(st); | ||
2259 | return NULL; | 2260 | return NULL; |
2261 | } | ||
2260 | 2262 | ||
2261 | memcpy(&st->chip.d9.cfg, cfg, sizeof(struct dib9000_config)); | 2263 | memcpy(&st->chip.d9.cfg, cfg, sizeof(struct dib9000_config)); |
2262 | st->i2c.i2c_adap = i2c_adap; | 2264 | st->i2c.i2c_adap = i2c_adap; |