diff mbox

[1/1] EM28xx - Fix memory leak on disconnect or error.

Message ID 4E63D3A6.3010505@yahoo.com (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Rankin Sept. 4, 2011, 7:38 p.m. UTC
Mauro,

This patch seems to have been missed, so I'm resending it.

Release the dev->alt_max_pkt_size buffer in all cases.

Signed-off-by: Chris Rankin <rankincj@yahoo.com>

Cheers,
Chris
diff mbox

Patch

--- linux/drivers/media/video/em28xx/em28xx-cards.c.orig	2011-09-04 20:30:14.000000000 +0100
+++ linux/drivers/media/video/em28xx/em28xx-cards.c	2011-09-04 20:28:59.000000000 +0100
@@ -3200,6 +3200,7 @@ 
 	retval = em28xx_init_dev(&dev, udev, interface, nr);
 	if (retval) {
 		mutex_unlock(&dev->lock);
+		kfree(dev->alt_max_pkt_size);
 		kfree(dev);
 		goto err;
 	}
--- linux/drivers/media/video/em28xx/em28xx-video.c.orig	2011-09-04 20:16:52.000000000 +0100
+++ linux/drivers/media/video/em28xx/em28xx-video.c	2011-09-04 20:27:41.000000000 +0100
@@ -2200,6 +2200,7 @@ 
 		   free the remaining resources */
 		if (dev->state & DEV_DISCONNECTED) {
 			em28xx_release_resources(dev);
+			kfree(dev->alt_max_pkt_size);
 			kfree(dev);
 			return 0;
 		}