From ebd0790c91fedf5508ef49a13527bc386d18e0d9 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 13 Oct 2007 10:49:52 -0400 Subject: Double-free in cx23885_initdev From: Florin Malita Both cx23885_initdev and cx23885_dev_setup free the device in their error path so a failure in the latter causes a double-free. Since cx23885_dev_setup is only called from cx23885_initdev, it should be safe to remove its deallocation and leave the cleanup up to the allocating function. Coverity CID 1922. Signed-off-by: Florin Malita CC: Steven Toth Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/cx23885/cx23885-core.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/linux/drivers/media/video/cx23885/cx23885-core.c b/linux/drivers/media/video/cx23885/cx23885-core.c index 03ed18894..1ffc9695e 100644 --- a/linux/drivers/media/video/cx23885/cx23885-core.c +++ b/linux/drivers/media/video/cx23885/cx23885-core.c @@ -794,7 +794,7 @@ static int cx23885_dev_setup(struct cx23885_dev *dev) dev->pci->subsystem_device); cx23885_devcount--; - goto fail_free; + return -ENODEV; } /* PCIe stuff */ @@ -836,10 +836,6 @@ static int cx23885_dev_setup(struct cx23885_dev *dev) } return 0; - -fail_free: - kfree(dev); - return -ENODEV; } void cx23885_dev_unregister(struct cx23885_dev *dev) -- cgit v1.2.3