ChangeSet 1.1006.11.9, 2003/03/14 11:49:08-08:00, green@linuxhacker.ru [PATCH] USB: Memleak in drivers/usb/hub.c::usb_reset_device 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. drivers/usb/hub.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) diff -Nru a/drivers/usb/hub.c b/drivers/usb/hub.c --- a/drivers/usb/hub.c Thu Mar 27 16:02:19 2003 +++ b/drivers/usb/hub.c Thu Mar 27 16:02:19 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);