Skip to contentSkip to conversation

cbus-tahvo-usb: Fix struct tahvo_usb memory leak on exit

PATCH In review Michael Buesch 2 participants 2 messages Mar 9, 2011 – Mar 10, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cbus-tahvo-usb: Fix struct tahvo_usb memory leak on exit

The struct tahvo_usb must be free'd on remove.

---

drivers/cbus/tahvo-usb.c +4 -0
Index: linux-2.6.38-rc7/drivers/cbus/tahvo-usb.c
===================================================================
@@ -725,6 +725,8 @@ static int __init tahvo_usb_probe(struct
 
 static int __exit tahvo_usb_remove(struct platform_device *pdev)
 {
+	struct tahvo_usb *tu = platform_get_drvdata(pdev);
+
 	dev_dbg(&pdev->dev, "remove\n");
 
 	tahvo_free_irq(TAHVO_INT_VBUSON);
@@ -734,6 +736,8 @@ static int __exit tahvo_usb_remove(struc
 #ifdef CONFIG_USB_OTG
 	device_remove_file(&pdev->dev, &dev_attr_otg_mode);
 #endif
+
+	kfree(tu);
 	tahvo_usb_device = NULL;
 
 	return 0;
Signature · 1 line
Greetings, Michael.