From: Chris Rankin Date: Sun, 4 Sep 2011 18:38:14 +0000 (-0300) Subject: [media] EM28xx - Fix memory leak on disconnect or error X-Git-Tag: MMI-PSA29.97-13-9~18177^2~170 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=16e3d2f4fab6e001a79705fa273418afc10188f8;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git [media] EM28xx - Fix memory leak on disconnect or error Release the dev->alt_max_pkt_size buffer in all cases. Signed-off-by: Chris Rankin Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 5fddcd0869de..013e946bdc45 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c @@ -3201,6 +3201,7 @@ static int em28xx_usb_probe(struct usb_interface *interface, retval = em28xx_init_dev(&dev, udev, interface, nr); if (retval) { mutex_unlock(&dev->lock); + kfree(dev->alt_max_pkt_size); kfree(dev); goto err; } diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index d176dc0394e2..61f35c8d66d2 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -2200,6 +2200,7 @@ static int em28xx_v4l2_close(struct file *filp) free the remaining resources */ if (dev->state & DEV_DISCONNECTED) { em28xx_release_resources(dev); + kfree(dev->alt_max_pkt_size); kfree(dev); return 0; }