Commit ff086575 authored by Andy Walls's avatar Andy Walls Committed by Mauro Carvalho Chehab

V4L/DVB (9297): cx18: Fix memory leak on card initialization failure

On error exit, the cx18_probe() function did not use the proper entry in
cx18_cards[] with kfree() when card init failed; leaking memory.
Signed-off-by: default avatarAndy Walls <awalls@radix.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 2515ddc6
...@@ -613,6 +613,7 @@ static int __devinit cx18_probe(struct pci_dev *dev, ...@@ -613,6 +613,7 @@ static int __devinit cx18_probe(struct pci_dev *dev,
const struct pci_device_id *pci_id) const struct pci_device_id *pci_id)
{ {
int retval = 0; int retval = 0;
int i;
int vbi_buf_size; int vbi_buf_size;
u32 devtype; u32 devtype;
struct cx18 *cx; struct cx18 *cx;
...@@ -836,8 +837,11 @@ static int __devinit cx18_probe(struct pci_dev *dev, ...@@ -836,8 +837,11 @@ static int __devinit cx18_probe(struct pci_dev *dev,
CX18_ERR("Error %d on initialization\n", retval); CX18_ERR("Error %d on initialization\n", retval);
cx18_log_statistics(cx); cx18_log_statistics(cx);
kfree(cx18_cards[cx18_cards_active]); i = cx->num;
cx18_cards[cx18_cards_active] = NULL; spin_lock(&cx18_cards_lock);
kfree(cx18_cards[i]);
cx18_cards[i] = NULL;
spin_unlock(&cx18_cards_lock);
return retval; return retval;
} }
......
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