aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorAndy Walls <awalls@radix.net>2008-10-18 07:51:28 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-10-21 12:20:39 -0400
commitff086575b7fbfcf48c1e2bc6f8914cbfc2c4ea37 (patch)
treed0046be6f8f0e480e4ca3eb94904313e10bcc104 /drivers/media
parent2515ddc6db8eb49a79f0fe5e67ff09ac7c81eab4 (diff)
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: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/cx18/cx18-driver.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c
index 085121c2b47f..ef60f561d956 100644
--- a/drivers/media/video/cx18/cx18-driver.c
+++ b/drivers/media/video/cx18/cx18-driver.c
@@ -613,6 +613,7 @@ static int __devinit cx18_probe(struct pci_dev *dev,
613 const struct pci_device_id *pci_id) 613 const struct pci_device_id *pci_id)
614{ 614{
615 int retval = 0; 615 int retval = 0;
616 int i;
616 int vbi_buf_size; 617 int vbi_buf_size;
617 u32 devtype; 618 u32 devtype;
618 struct cx18 *cx; 619 struct cx18 *cx;
@@ -836,8 +837,11 @@ err:
836 CX18_ERR("Error %d on initialization\n", retval); 837 CX18_ERR("Error %d on initialization\n", retval);
837 cx18_log_statistics(cx); 838 cx18_log_statistics(cx);
838 839
839 kfree(cx18_cards[cx18_cards_active]); 840 i = cx->num;
840 cx18_cards[cx18_cards_active] = NULL; 841 spin_lock(&cx18_cards_lock);
842 kfree(cx18_cards[i]);
843 cx18_cards[i] = NULL;
844 spin_unlock(&cx18_cards_lock);
841 return retval; 845 return retval;
842} 846}
843 847