Browse Source

USB: serial: garmin_gps: fix memory leak on failed URB submit

Make sure to free the URB transfer buffer in case submission fails (e.g.
due to a disconnect).

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Johan Hovold 9 years ago
parent
commit
c4ac4496e8
1 changed files with 1 additions and 0 deletions
  1. 1 0
      drivers/usb/serial/garmin_gps.c

+ 1 - 0
drivers/usb/serial/garmin_gps.c

@@ -1043,6 +1043,7 @@ static int garmin_write_bulk(struct usb_serial_port *port,
 		   "%s - usb_submit_urb(write bulk) failed with status = %d\n",
 		   "%s - usb_submit_urb(write bulk) failed with status = %d\n",
 				__func__, status);
 				__func__, status);
 		count = status;
 		count = status;
+		kfree(buffer);
 	}
 	}
 
 
 	/* we are done with this urb, so let the host driver
 	/* we are done with this urb, so let the host driver