From: Andy Walls Date: Sat, 21 Feb 2009 22:53:54 +0000 (-0300) Subject: V4L/DVB (10760): cx18: Fix a memory leak of buffers used for sliced VBI insertion X-Git-Tag: firefly_0821_release~15196^2~388 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=6da6bf5e43f409672f5525657ff59282e160c59f;p=firefly-linux-kernel-4.4.55.git V4L/DVB (10760): cx18: Fix a memory leak of buffers used for sliced VBI insertion We leaked buffers every time a device was removed, if the user had enabled sliced VBI insertion into the MPEG stream. MythTV uses that. Signed-off-by: Andy Walls Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c index 79b3bf5bcec1..544abbfb843e 100644 --- a/drivers/media/video/cx18/cx18-driver.c +++ b/drivers/media/video/cx18/cx18-driver.c @@ -1066,6 +1066,7 @@ static void cx18_remove(struct pci_dev *pci_dev) { struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev); struct cx18 *cx = to_cx18(v4l2_dev); + int i; CX18_DEBUG_INFO("Removing Card\n"); @@ -1095,7 +1096,10 @@ static void cx18_remove(struct pci_dev *pci_dev) release_mem_region(cx->base_addr, CX18_MEM_SIZE); pci_disable_device(cx->pci_dev); - /* FIXME - we leak cx->vbi.sliced_mpeg_data[i] allocations */ + + if (cx->vbi.sliced_mpeg_data[0] != NULL) + for (i = 0; i < CX18_VBI_FRAMES; i++) + kfree(cx->vbi.sliced_mpeg_data[i]); CX18_INFO("Removed %s\n", cx->card_name);