[PATCH 0/1] MR412: wineusb.sys: Fix memory leak on control transfer.
Signed-off-by: Jinoh Kang <jinoh.kang.kr(a)gmail.com> -- https://gitlab.winehq.org/wine/wine/-/merge_requests/412
From: Jinoh Kang <jinoh.kang.kr(a)gmail.com> Signed-off-by: Jinoh Kang <jinoh.kang.kr(a)gmail.com> --- dlls/wineusb.sys/wineusb.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dlls/wineusb.sys/wineusb.c b/dlls/wineusb.sys/wineusb.c index 0b8af43a3dc..e1ec7d3d9bc 100644 --- a/dlls/wineusb.sys/wineusb.c +++ b/dlls/wineusb.sys/wineusb.c @@ -824,6 +824,11 @@ static void LIBUSB_CALL transfer_cb(struct libusb_transfer *transfer) } } + if (urb->UrbHeader.Function != URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER) + { + free(transfer->buffer); + } + event.type = USB_EVENT_TRANSFER_COMPLETE; event.u.completed_irp = irp; queue_event(&event); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/412
On 7/9/22 11:10, Jinoh Kang wrote:
From: Jinoh Kang <jinoh.kang.kr(a)gmail.com>
Signed-off-by: Jinoh Kang <jinoh.kang.kr(a)gmail.com> --- dlls/wineusb.sys/wineusb.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/dlls/wineusb.sys/wineusb.c b/dlls/wineusb.sys/wineusb.c index 0b8af43a3dc..e1ec7d3d9bc 100644 --- a/dlls/wineusb.sys/wineusb.c +++ b/dlls/wineusb.sys/wineusb.c @@ -824,6 +824,11 @@ static void LIBUSB_CALL transfer_cb(struct libusb_transfer *transfer) } }
+ if (urb->UrbHeader.Function != URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER) + { + free(transfer->buffer); + } + event.type = USB_EVENT_TRANSFER_COMPLETE; event.u.completed_irp = irp; queue_event(&event);
We use LIBUSB_TRANSFER_FREE_TRANSFER for these cases.
On Sat Jul 9 16:48:25 2022 +0000, **** wrote:
Zebediah Figura replied on the mailing list: ``` On 7/9/22 11:10, Jinoh Kang wrote:
From: Jinoh Kang <jinoh.kang.kr(a)gmail.com>
Signed-off-by: Jinoh Kang <jinoh.kang.kr(a)gmail.com> --- dlls/wineusb.sys/wineusb.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/dlls/wineusb.sys/wineusb.c b/dlls/wineusb.sys/wineusb.c index 0b8af43a3dc..e1ec7d3d9bc 100644 --- a/dlls/wineusb.sys/wineusb.c +++ b/dlls/wineusb.sys/wineusb.c @@ -824,6 +824,11 @@ static void LIBUSB_CALL transfer_cb(struct libusb_transfer *transfer) } }
+ if (urb->UrbHeader.Function != URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER) + { + free(transfer->buffer); + } + event.type = USB_EVENT_TRANSFER_COMPLETE; event.u.completed_irp = irp; queue_event(&event); We use LIBUSB_TRANSFER_FREE_TRANSFER for these cases.
wine-gitlab mailing list -- wine-gitlab(a)winehq.org To unsubscribe send an email to wine-gitlab-leave(a)winehq.org ``` I never imagined that a library would hard-code the choice of memory management function on a user-supplied buffer. Sorry for the noise.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/412#note_3823
On 7/9/22 12:38, Jinoh Kang (@iamahuman) wrote:
On Sat Jul 9 16:48:25 2022 +0000, **** wrote:
Zebediah Figura replied on the mailing list: ``` On 7/9/22 11:10, Jinoh Kang wrote:
From: Jinoh Kang <jinoh.kang.kr(a)gmail.com>
Signed-off-by: Jinoh Kang <jinoh.kang.kr(a)gmail.com> --- dlls/wineusb.sys/wineusb.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/dlls/wineusb.sys/wineusb.c b/dlls/wineusb.sys/wineusb.c index 0b8af43a3dc..e1ec7d3d9bc 100644 --- a/dlls/wineusb.sys/wineusb.c +++ b/dlls/wineusb.sys/wineusb.c @@ -824,6 +824,11 @@ static void LIBUSB_CALL transfer_cb(struct libusb_transfer *transfer) } }
+ if (urb->UrbHeader.Function != URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER) + { + free(transfer->buffer); + } + event.type = USB_EVENT_TRANSFER_COMPLETE; event.u.completed_irp = irp; queue_event(&event); We use LIBUSB_TRANSFER_FREE_TRANSFER for these cases.
wine-gitlab mailing list -- wine-gitlab(a)winehq.org To unsubscribe send an email to wine-gitlab-leave(a)winehq.org ``` I never imagined that a library would hard-code the choice of memory management function on a user-supplied buffer. Sorry for the noise.
Well, I'd hardly call it hard-coded; you're free to omit the flag if you want to use a different free function. It's just a convenience.
This merge request was closed by Jinoh Kang. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/412
participants (3)
-
Jinoh Kang -
Jinoh Kang (@iamahuman) -
Zebediah Figura