V4L/DVB (13961): em28xx-dvb: fix memleak in dvb_fini()
authorFrancesco Lavra <francescolavra@interfree.it>
Thu, 31 Dec 2009 11:47:11 +0000 (08:47 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 26 Feb 2010 18:10:34 +0000 (15:10 -0300)
this patch fixes a memory leak which occurs when an em28xx card with DVB
extension is unplugged or its DVB extension driver is unloaded. In
dvb_fini(), dev->dvb must be freed before being set to NULL, as is done
in dvb_init() in case of error.
Note that this bug is also present in the latest stable kernel release.

Signed-off-by: Francesco Lavra <francescolavra@interfree.it>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/em28xx/em28xx-dvb.c

index cc0505e..6b0a495 100644 (file)
@@ -606,6 +606,7 @@ static int dvb_fini(struct em28xx *dev)
 
        if (dev->dvb) {
                unregister_dvb(dev->dvb);
+               kfree(dev->dvb);
                dev->dvb = NULL;
        }