[PATCH]omninet memory leak in error case

Oliver Neukum <[email protected]>
Newsgroups gmane.linux.usb.devel
Organization Novell
Message-ID <[email protected]>
Hi,

memory allocated must be freed in the error case.

	Regards
		Oliver

Signed-off-by: Oliver Neukum <[email protected]>
-- 

--- linux-2.6.21-rc4/drivers/usb/serial/omninet.c.alt	2007-03-20 13:09:01.000000000 +0100
+++ linux-2.6.21-rc4/drivers/usb/serial/omninet.c	2007-03-20 13:09:49.000000000 +0100
@@ -170,8 +170,12 @@
 		      port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length,
 		      omninet_read_bulk_callback, port);
 	result = usb_submit_urb(port->read_urb, GFP_KERNEL);
-	if (result)
+	if (result) {
 		err("%s - failed submitting read urb, error %d", __FUNCTION__, result);
+		/* open failed - all allocations must be freed */
+		kfree(od);
+		usb_set_serial_port_data(port, NULL);
+	}
 
 	return result;
 }
 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.