Commit a148b1f3 authored by Randy Dunlap's avatar Randy Dunlap Committed by Linus Torvalds

[PATCH] USB: cdc-acm memory leak

The Stanford Checker discovered a memory leak in cdc-acm.
This patch to 2.5.59 fixes it.  Please apply.
parent 3dd5d577
...@@ -606,6 +606,7 @@ static int acm_probe (struct usb_interface *intf, ...@@ -606,6 +606,7 @@ static int acm_probe (struct usb_interface *intf,
if (!acm->ctrlurb) { if (!acm->ctrlurb) {
err("out of memory"); err("out of memory");
kfree(acm); kfree(acm);
kfree(buf);
return -ENOMEM; return -ENOMEM;
} }
acm->readurb = usb_alloc_urb(0, GFP_KERNEL); acm->readurb = usb_alloc_urb(0, GFP_KERNEL);
...@@ -613,6 +614,7 @@ static int acm_probe (struct usb_interface *intf, ...@@ -613,6 +614,7 @@ static int acm_probe (struct usb_interface *intf,
err("out of memory"); err("out of memory");
usb_free_urb(acm->ctrlurb); usb_free_urb(acm->ctrlurb);
kfree(acm); kfree(acm);
kfree(buf);
return -ENOMEM; return -ENOMEM;
} }
acm->writeurb = usb_alloc_urb(0, GFP_KERNEL); acm->writeurb = usb_alloc_urb(0, GFP_KERNEL);
...@@ -621,6 +623,7 @@ static int acm_probe (struct usb_interface *intf, ...@@ -621,6 +623,7 @@ static int acm_probe (struct usb_interface *intf,
usb_free_urb(acm->readurb); usb_free_urb(acm->readurb);
usb_free_urb(acm->ctrlurb); usb_free_urb(acm->ctrlurb);
kfree(acm); kfree(acm);
kfree(buf);
return -ENOMEM; return -ENOMEM;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment