Module Name: src Committed By: bouyer Date: Sat Jan 16 17:03:04 UTC 2010
Modified Files: src/sys/dev/usb: usbdi.c Log Message: Fix leak of a usbd_xfer_handle when a interrupt pipe is aborted then closed: usbd_open_pipe_intr() allocates a usbd_xfer_handle for pipe->intrxfer. Most usb device drivers using interrupt pipes call usbd_abort_pipe() then usbd_close_pipe(), usbd_close_pipe() is supposed to free pipe->intrxfer. But usbd_abort_pipe() calls [uoe]hci_device_intr_abort() which, if the xfer aborted is pipe's intrxfer, sets pipe->intrxfer to NULL. So usbd_close_pipe() can't free it and the usbd_xfer_handle is lost. To fix this, in usbd_abort_pipe() remember the pipe->intrxfer's value on entrie, and if it's different after usbd_ar_pipe(), call usbd_free_xfer with the original value. Confirmed to fix the memory leak on close() with umodem(4) and uplcom(4). To generate a diff of this commit: cvs rdiff -u -r1.126 -r1.127 src/sys/dev/usb/usbdi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.