[PATCH 2/2] quartz: Avoid accessing the advise_sink structure after it is queued.

Zebediah Figura zfigura at codeweavers.com
Thu Oct 21 12:41:12 CDT 2021


It could already have been removed and freed.

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
 dlls/quartz/systemclock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/quartz/systemclock.c b/dlls/quartz/systemclock.c
index 56ad217c76a..f579ae754ea 100644
--- a/dlls/quartz/systemclock.c
+++ b/dlls/quartz/systemclock.c
@@ -206,6 +206,7 @@ static HRESULT add_sink(struct system_clock *clock, DWORD_PTR handle,
     sink->due_time = due_time;
     sink->period = period;
     sink->cookie = InterlockedIncrement(&cookie_counter);
+    *cookie = sink->cookie;
 
     EnterCriticalSection(&clock->cs);
     list_add_tail(&clock->sinks, &sink->entry);
@@ -217,7 +218,6 @@ static HRESULT add_sink(struct system_clock *clock, DWORD_PTR handle,
     }
     WakeConditionVariable(&clock->cv);
 
-    *cookie = sink->cookie;
     return S_OK;
 }
 
-- 
2.33.0




More information about the wine-devel mailing list