Patchwork [media] radio-maxiradio: fix memory leak when device is removed

login
register
mail settings
Submitter Alexey Khoroshilov
Date June 3, 2016, 10:33 p.m.
Message ID <1464993186-9329-1-git-send-email-khoroshilov@ispras.ru>
Download mbox | patch
Permalink /patch/9154199/
State New
Headers show

Comments

Alexey Khoroshilov - June 3, 2016, 10:33 p.m.
Memory allocated for maxiradio device is not deallocated when
the device is removed.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
---
 drivers/media/radio/radio-maxiradio.c | 1 +
 1 file changed, 1 insertion(+)

Patch

diff --git a/drivers/media/radio/radio-maxiradio.c b/drivers/media/radio/radio-maxiradio.c
index 70fd8e80198a..8253f79d5d75 100644
--- a/drivers/media/radio/radio-maxiradio.c
+++ b/drivers/media/radio/radio-maxiradio.c
@@ -183,6 +183,7 @@  static void maxiradio_remove(struct pci_dev *pdev)
 	outb(0, dev->io);
 	v4l2_device_unregister(v4l2_dev);
 	release_region(pci_resource_start(pdev, 0), pci_resource_len(pdev, 0));
+	kfree(dev);
 }
 
 static struct pci_device_id maxiradio_pci_tbl[] = {