[PATCH] cx231xx-dvb: fix memory leak in dvb_fini()

From: Young Xiao
Date: Tue May 28 2019 - 08:40:26 EST


In dvb_init(), dev->dvb is allocated by kzalloc.
Therefore, it must be freed being set to NULL.

Signed-off-by: Young Xiao <92siuyang@xxxxxxxxx>
---
drivers/media/usb/cx231xx/cx231xx-dvb.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/media/usb/cx231xx/cx231xx-dvb.c b/drivers/media/usb/cx231xx/cx231xx-dvb.c
index 89357cb..89839c7 100644
--- a/drivers/media/usb/cx231xx/cx231xx-dvb.c
+++ b/drivers/media/usb/cx231xx/cx231xx-dvb.c
@@ -1159,6 +1159,7 @@ static int dvb_fini(struct cx231xx *dev)

if (dev->dvb) {
unregister_dvb(dev->dvb);
+ kfree(dev->dvb);
dev->dvb = NULL;
}

--
2.7.4