public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2.6.19-rc4] usb auerswald possible memleak fix
@ 2006-11-06 18:03 Mariusz Kozlowski
  2006-11-06 23:31 ` Mariusz Kozlowski
  0 siblings, 1 reply; 6+ messages in thread
From: Mariusz Kozlowski @ 2006-11-06 18:03 UTC (permalink / raw)
  To: Wolfgang Mües, Greg KH, linux-kernel

Hello,

	There is possible memleak in auerbuf_setup(). Fix is to replace kfree() with auerbuf_free().
An argument to usb_free_urb() does not need a check as usb_free_urb() already does that. Not sure if I should
send this in two separate patches. The patch is against 2.6.19-rc4 (not -mm).

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>

diff -up linux-2.6.19-rc4-orig/drivers/usb/misc/auerswald.c linux-2.6.19-rc4/drivers/usb/misc/auerswald.c
--- linux-2.6.19-rc4-orig/drivers/usb/misc/auerswald.c  2006-11-06 17:08:20.000000000 +0100
+++ linux-2.6.19-rc4/drivers/usb/misc/auerswald.c       2006-11-06 18:25:32.000000000 +0100
@@ -704,9 +704,7 @@ static void auerbuf_free (pauerbuf_t bp)
 {
        kfree(bp->bufp);
        kfree(bp->dr);
-       if (bp->urbp) {
-               usb_free_urb(bp->urbp);
-       }
+       usb_free_urb(bp->urbp);
        kfree(bp);
 }
 
@@ -780,7 +778,7 @@ static int auerbuf_setup (pauerbufctl_t 
 
 bl_fail:/* not enough memory. Free allocated elements */
         dbg ("auerbuf_setup: no more memory");
-       kfree(bep);
+        auerbuf_free(bep);
         auerbuf_free_buffers (bcp);
         return -ENOMEM;
 }
@@ -1085,10 +1083,8 @@ exit:
 */
 static void auerswald_int_free (pauerswald_t cp)
 {
-       if (cp->inturbp) {
-               usb_free_urb(cp->inturbp);
-               cp->inturbp = NULL;
-       }
+       usb_free_urb(cp->inturbp);
+       cp->inturbp = NULL;
        kfree(cp->intbufp);
        cp->intbufp = NULL;
 }

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-11-07 20:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-06 18:03 [PATCH 2.6.19-rc4] usb auerswald possible memleak fix Mariusz Kozlowski
2006-11-06 23:31 ` Mariusz Kozlowski
2006-11-07  0:27   ` Greg KH
2006-11-07  9:25     ` Mariusz Kozlowski
2006-11-07 11:53       ` Greg KH
2006-11-07 20:02   ` Wolfgang Mües

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox