From: Trent Piepho Date: Fri, 5 Oct 2007 14:28:09 +0000 (-0300) Subject: V4L/DVB (6336): cx8802: Plug memory leak when unregistering a driver X-Git-Tag: v2.6.24-rc1~66^2~20 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a04036a3129e09a9b9097de2b1f77dd82a6e9ac3;p=linux-2.6 V4L/DVB (6336): cx8802: Plug memory leak when unregistering a driver When a cx8802 sub-driver was unregistered, the struct cx8802_driver, which was kmalloc()ed by cx8802_register_driver(), was deleted from the list of drivers, but never freed. Signed-off-by: Trent Piepho Reviewed-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c index d4858e4c3e..448c673809 100644 --- a/drivers/media/video/cx88/cx88-mpeg.c +++ b/drivers/media/video/cx88/cx88-mpeg.c @@ -735,6 +735,7 @@ int cx8802_unregister_driver(struct cx8802_driver *drv) mutex_lock(&drv->core->lock); list_del(&d->drvlist); mutex_unlock(&drv->core->lock); + kfree(d); } else printk(KERN_ERR "%s/2: cx8802 driver remove " "failed (%d)\n", dev->core->name, err); @@ -817,6 +818,7 @@ static void __devexit cx8802_remove(struct pci_dev *pci_dev) } else printk(KERN_ERR "%s/2: cx8802 driver remove " "failed (%d)\n", dev->core->name, err); + kfree(drv); } }