[media] bt8xx: fix memory leak
authorSudip Mukherjee <sudipm.mukherjee@gmail.com>
Fri, 16 Dec 2016 21:31:49 +0000 (19:31 -0200)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Tue, 31 Jan 2017 09:42:20 +0000 (07:42 -0200)
If dvb_attach() fails then we were just printing an error message and
exiting but the memory allocated to state was not released.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/pci/bt8xx/dvb-bt8xx.c

index ca047f7a6dc0a600332b5c9d2b627928d190c900..ad617871ce9b003940b0e06a275fb2e31aed7ff9 100644 (file)
@@ -679,6 +679,7 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
                /*      DST is not a frontend, attaching the ASIC       */
                if (dvb_attach(dst_attach, state, &card->dvb_adapter) == NULL) {
                        pr_err("%s: Could not find a Twinhan DST\n", __func__);
+                       kfree(state);
                        break;
                }
                /*      Attach other DST peripherals if any             */