Skip to contentSkip to conversation

UEAGLE : memory leack fix

PATCH In review matthieu castet 1 participant 2 messages Apr 2, 2006

Subsystems (3)
lore
Share & tools
lore

matthieu castet

author maintainer
#0 lore raw

PATCH 4/4 UEAGLE : memory leack fix

Hi,

this patch fix leak of memory allocated to intr if allocation of sc->urb_int fails. Found by the Coverity checker.

ueagle-atm.c +3 -3
Index: ueagle-atm.c
===================================================================
@@ -1376,7 +1376,7 @@
 	if (ret < 0) {
 		uea_err(INS_TO_USBDEV(sc),
 		       "urb submition failed with error %d\n", ret);
-		goto err1;
+		goto err;
 	}
 
 	sc->kthread = kthread_run(uea_kthread, sc, "ueagle-atm");
@@ -1390,10 +1390,10 @@
 
 err2:
 	usb_kill_urb(sc->urb_int);
-err1:
-	kfree(intr);
 err:
 	usb_free_urb(sc->urb_int);
+	sc->urb_int = NULL;
+	kfree(intr);
 	uea_leaves(INS_TO_USBDEV(sc));
 	return -ENOMEM;
 }
author maintainer
#1 lore raw
Quoted 5 lines · matthieu castet

Hi,

this patch fix leak of memory allocated to intr if allocation of sc->urb_int fails. Found by the Coverity checker.

add correct path for the file name

drivers/usb/atm/ueagle-atm.c +3 -3
Index: ueagle-atm.c
===================================================================
@@ -1376,7 +1376,7 @@
 	if (ret < 0) {
 		uea_err(INS_TO_USBDEV(sc),
 		       "urb submition failed with error %d\n", ret);
-		goto err1;
+		goto err;
 	}
 
 	sc->kthread = kthread_run(uea_kthread, sc, "ueagle-atm");
@@ -1390,10 +1390,10 @@
 
 err2:
 	usb_kill_urb(sc->urb_int);
-err1:
-	kfree(intr);
 err:
 	usb_free_urb(sc->urb_int);
+	sc->urb_int = NULL;
+	kfree(intr);
 	uea_leaves(INS_TO_USBDEV(sc));
 	return -ENOMEM;
 }