ntoskrnl: Free memory before pointer gets set to NULL.

Bernhard Übelacker bernhardu at mailbox.org
Wed Mar 16 05:01:05 CDT 2022


Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52322
Signed-off-by: Bernhard Übelacker <bernhardu at mailbox.org>
---
 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 f8e1c24bb49..fca8f1d11a1 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;
                 }
-- 
2.35.1




More information about the wine-devel mailing list