diff options
author | Andy Walls <awalls@radix.net> | 2008-10-18 07:51:28 -0400 |
---|---|---|
committer | Andy Walls <awalls@radix.net> | 2008-10-18 07:51:28 -0400 |
commit | 7610bcd8a954afb71a5d0aa514e57458296cd513 (patch) | |
tree | 76d17b5be8223df8c1b21d5cfa24af7fdf3a72c1 | |
parent | 3beaddc560d35b83ba5793dcbe8c3a49ac58cdc7 (diff) | |
download | mediapointer-dvb-s2-7610bcd8a954afb71a5d0aa514e57458296cd513.tar.gz mediapointer-dvb-s2-7610bcd8a954afb71a5d0aa514e57458296cd513.tar.bz2 |
cx18: Fix memory leak on card initialization failure
From: Andy Walls <awalls@radix.net>
On error exit, the cx18_probe() function did not use the proper entry in
cx18_cards[] with kfree() when card init failed; leaking memory.
Priority: normal
Signed-off-by: Andy Walls <awalls@radix.net>
-rw-r--r-- | linux/drivers/media/video/cx18/cx18-driver.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/linux/drivers/media/video/cx18/cx18-driver.c b/linux/drivers/media/video/cx18/cx18-driver.c index 085121c2b..ef60f561d 100644 --- a/linux/drivers/media/video/cx18/cx18-driver.c +++ b/linux/drivers/media/video/cx18/cx18-driver.c @@ -613,6 +613,7 @@ static int __devinit cx18_probe(struct pci_dev *dev, const struct pci_device_id *pci_id) { int retval = 0; + int i; int vbi_buf_size; u32 devtype; struct cx18 *cx; @@ -836,8 +837,11 @@ err: CX18_ERR("Error %d on initialization\n", retval); cx18_log_statistics(cx); - kfree(cx18_cards[cx18_cards_active]); - cx18_cards[cx18_cards_active] = NULL; + i = cx->num; + spin_lock(&cx18_cards_lock); + kfree(cx18_cards[i]); + cx18_cards[i] = NULL; + spin_unlock(&cx18_cards_lock); return retval; } |