[media] EM28xx - Fix memory leak on disconnect or error
authorChris Rankin <rankincj@yahoo.com>
Sun, 4 Sep 2011 18:38:14 +0000 (15:38 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 18 Sep 2011 10:58:01 +0000 (07:58 -0300)
Release the dev->alt_max_pkt_size buffer in all cases.

Signed-off-by: Chris Rankin <rankincj@yahoo.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/em28xx/em28xx-cards.c
drivers/media/video/em28xx/em28xx-video.c

index 5fddcd0869deec215ab0c91df6943b98f03d0b54..013e946bdc45a76ba30188647b88de03168a6e70 100644 (file)
@@ -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;
        }
index d176dc0394e2f9c276c4e333f695c7c91f39a563..61f35c8d66d22871aff74e9c0a3d72e277d5b668 100644 (file)
@@ -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;
                }