[PATCH 0/1] MR2439: ntoskrnl: Free memory before pointer gets set to NULL.
Without this patch the memory pointed to by context->in_buff gets leaked on each call to GetVolumeInformationByHandleW and the memory usage of winedevice.exe grows. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52322 -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2439
From: Bernhard Übelacker <bernhardu(a)mailbox.org> Without this patch the memory pointed to by context->in_buff gets leaked on each call to GetVolumeInformationByHandleW and the memory usage of winedevice.exe grows. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52322 --- dlls/ntoskrnl.exe/ntoskrnl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index 2d506402036..507521d5864 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -832,6 +832,7 @@ static NTSTATUS dispatch_volume( struct dispatch_context *context ) irp->Tail.Overlay.Thread = (PETHREAD)KeGetCurrentThread(); irp->Tail.Overlay.OriginalFileObject = file; irp->RequestorMode = UserMode; + HeapFree( GetProcessHeap(), 0, context->in_buff ); context->in_buff = NULL; irp->Flags |= IRP_DEALLOCATE_BUFFER; /* deallocate out_buff */ @@ -1044,6 +1045,7 @@ NTSTATUS CDECL wine_ntoskrnl_main_loop( HANDLE stop_event ) if (ret == WAIT_OBJECT_0) { HeapFree( GetProcessHeap(), 0, context.in_buff ); + context.in_buff = NULL; status = STATUS_SUCCESS; goto done; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/2439
This seems fine to me. Just needs a rebase. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2439#note_28598
This merge request was approved by Etaash Mathamsetty. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2439
participants (2)
-
Bernhard Übelacker -
Etaash Mathamsetty (@etaash.mathamsetty)