Huw Davies : winecoreaudio: Set the buffer to NULL after freeing.

Alexandre Julliard julliard at winehq.org
Wed Dec 22 16:17:56 CST 2021


Module: wine
Branch: master
Commit: e03611ee599a47593742414540cd01a0ed9623c2
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=e03611ee599a47593742414540cd01a0ed9623c2

Author: Huw Davies <huw at codeweavers.com>
Date:   Tue Dec 21 15:45:12 2021 +0000

winecoreaudio: Set the buffer to NULL after freeing.

This ensures the subsequent allocation is free to pick a new location.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52202
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winecoreaudio.drv/coreaudio.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/dlls/winecoreaudio.drv/coreaudio.c b/dlls/winecoreaudio.drv/coreaudio.c
index 00bd79927ca..4bb83a37621 100644
--- a/dlls/winecoreaudio.drv/coreaudio.c
+++ b/dlls/winecoreaudio.drv/coreaudio.c
@@ -1352,8 +1352,11 @@ static NTSTATUS get_render_buffer(void *args)
 
     if(stream->wri_offs_frames + params->frames > stream->bufsize_frames){
         if(stream->tmp_buffer_frames < params->frames){
-            NtFreeVirtualMemory(GetCurrentProcess(), (void **)&stream->tmp_buffer,
-                                &stream->tmp_buffer_size, MEM_RELEASE);
+            if(stream->tmp_buffer){
+                NtFreeVirtualMemory(GetCurrentProcess(), (void **)&stream->tmp_buffer,
+                                    &stream->tmp_buffer_size, MEM_RELEASE);
+                stream->tmp_buffer = NULL;
+            }
             stream->tmp_buffer_size = params->frames * stream->fmt->nBlockAlign;
             if(NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&stream->tmp_buffer, 0,
                                        &stream->tmp_buffer_size, MEM_COMMIT, PAGE_READWRITE)){




More information about the wine-cvs mailing list