[PATCH] USB: UEAGLE : memory leack fix
authormatthieu castet <castet.matthieu@free.fr>
Sun, 2 Apr 2006 16:45:46 +0000 (18:45 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 14 Apr 2006 18:12:23 +0000 (11:12 -0700)
this patch fix leak of memory allocated to intr if allocation of
sc->urb_int fails.
Found by the Coverity checker.

Signed-off-by: Duncan Sands <baldrick@free.fr>
Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/atm/ueagle-atm.c

index 047fb4ea2fa64ae07163f153b649e22c1e48de89..b38990adf1cdaf7d15b1a3249350e840461bac6a 100644 (file)
@@ -1376,7 +1376,7 @@ static int uea_boot(struct uea_softc *sc)
        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 @@ static int uea_boot(struct uea_softc *sc)
 
 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;
 }