Skip to contentSkip to conversation

Memory leak in drivers/usb/serial/airprime.c

PATCH In review Eric Sesterhenn 2 participants 2 messages Oct 5, 2006 – Oct 6, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Memory leak in drivers/usb/serial/airprime.c

hi,

the commit http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=5dda171202f94127e49c12daf780cdae1b4e668b
added a memory leak. In case we cant allocate an urb, we dont free
the buffer and leak it. Coverity id #1438

drivers/usb/serial/airprime.c renamed from drivers/usb/serial/airprime.c.orig +1 -0
@@ -133,6 +133,7 @@ static int airprime_open(struct usb_seri
 		}
 		urb = usb_alloc_urb(0, GFP_KERNEL);
 		if (!urb) {
+			kfree(buffer);
 			dev_err(&port->dev, "%s - no more urbs?\n",
 				__FUNCTION__);
 			result = -ENOMEM;
Acked-by on v1 1/1
#1 lore raw

Hmm. And I really thought I'd plugged all the leaks....

Quoted 21 lines · Eric Sesterhenn

hi,

the commit http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=5dda171202f94127e49c12daf780cdae1b4e668b
added a memory leak. In case we cant allocate an urb, we dont free
the buffer and leak it. Coverity id #1438

drivers/usb/serial/airprime.c renamed from drivers/usb/serial/airprime.c.orig +1 -0
@@ -133,6 +133,7 @@ static int airprime_open(struct usb_seri
 		}
 		urb = usb_alloc_urb(0, GFP_KERNEL);
 		if (!urb) {
+			kfree(buffer);
 			dev_err(&port->dev, "%s - no more urbs?\n",
 				__FUNCTION__);
 			result = -ENOMEM;