From: Marc Kleine-Budde Date: Sat, 14 Dec 2013 13:36:25 +0000 (+0100) Subject: can: peak_usb: fix mem leak in pcan_usb_pro_init() X-Git-Url: http://git.mmlx.us/?a=commitdiff_plain;h=b52cc5df7872f64f206397a7dd3cfa2954725ea5;p=linux-edison.git can: peak_usb: fix mem leak in pcan_usb_pro_init() commit 20fb4eb96fb0350d28fc4d7cbfd5506711079592 upstream. This patch fixes a memory leak in pcan_usb_pro_init(). In patch f14e224 net: can: peak_usb: Do not do dma on the stack the struct pcan_usb_pro_fwinfo *fi and struct pcan_usb_pro_blinfo *bi were converted from stack to dynamic allocation va kmalloc(). However the corresponding kfree() was not introduced. This patch adds the missing kfree(). Reported-by: Stephane Grosjean Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c index 8ee9d1556e6..263dd921edc 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c +++ b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c @@ -927,6 +927,9 @@ static int pcan_usb_pro_init(struct peak_usb_device *dev) /* set LED in default state (end of init phase) */ pcan_usb_pro_set_led(dev, 0, 1); + kfree(bi); + kfree(fi); + return 0; err_out: