[PATCH V2] staging: ced1401: kfree the pdx at err path and remove callback

Devendra Naga devendra.aaru at gmail.com
Mon Apr 15 11:21:50 UTC 2013


leak introduced since pdx is not freed, free it at err path and
at remove callback

Signed-off-by: Devendra Naga <devendra.aaru at gmail.com>
---
V2: replace pdf with pdx
 drivers/staging/ced1401/usb1401.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/ced1401/usb1401.c b/drivers/staging/ced1401/usb1401.c
index 254131d..6787cb7 100644
--- a/drivers/staging/ced1401/usb1401.c
+++ b/drivers/staging/ced1401/usb1401.c
@@ -1502,6 +1502,7 @@ static int ced_probe(struct usb_interface *interface,
 error:
 	if (pdx)
 		kref_put(&pdx->kref, ced_delete);	// frees allocated memory
+	kfree(pdx);
 	return retval;
 }
 
@@ -1530,6 +1531,7 @@ static void ced_disconnect(struct usb_interface *interface)
 	kref_put(&pdx->kref, ced_delete);	// decrement our usage count
 
 	dev_info(&interface->dev, "USB cedusb #%d now disconnected", minor);
+	kfree(pdx);
 }
 
 // Wait for all the urbs we know of to be done with, then kill off any that
-- 
1.8.1.4




More information about the devel mailing list