public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [2.4] Memleak in drivers/usb/hub.c::usb_reset_device
@ 2003-03-12 19:41 Oleg Drokin
  2003-03-12 20:00 ` David Brownell
  2003-03-14 19:37 ` Greg KH
  0 siblings, 2 replies; 5+ messages in thread
From: Oleg Drokin @ 2003-03-12 19:41 UTC (permalink / raw)
  To: alan, linux-kernel, greg, david-b

Hello!

   There seems to be a memleak in drivers/usb/hub.c::usb_reset_device()
   on error exit path. See the patch.
   Found with help of smatch + enhanced unfree script.

Bye,
    Oleg
===== drivers/usb/hub.c 1.19 vs edited =====
--- 1.19/drivers/usb/hub.c	Sat Sep 21 00:12:53 2002
+++ edited/drivers/usb/hub.c	Wed Mar 12 22:38:43 2003
@@ -1057,8 +1057,10 @@
 	}
 	ret = usb_get_descriptor(dev, USB_DT_DEVICE, 0, descriptor,
 			sizeof(*descriptor));
-	if (ret < 0)
+	if (ret < 0) {
+		kfree(descriptor);
 		return ret;
+	}
 
 	le16_to_cpus(&descriptor->bcdUSB);
 	le16_to_cpus(&descriptor->idVendor);

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

end of thread, other threads:[~2003-03-19 23:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-12 19:41 [2.4] Memleak in drivers/usb/hub.c::usb_reset_device Oleg Drokin
2003-03-12 20:00 ` David Brownell
2003-03-14 19:37 ` Greg KH
2003-03-14 20:02   ` Oleg Drokin
2003-03-19 23:32     ` Greg KH

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