Commit 16e3d2f4 authored by Chris Rankin's avatar Chris Rankin Committed by Mauro Carvalho Chehab

[media] EM28xx - Fix memory leak on disconnect or error

Release the dev->alt_max_pkt_size buffer in all cases.
Signed-off-by: default avatarChris Rankin <rankincj@yahoo.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 75779112
......@@ -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;
}
......
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment