Marcus Meissner : quartz: Avoid linked list walk with free next (Coverity).

Alexandre Julliard julliard at winehq.org
Mon Aug 20 14:16:17 CDT 2012


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

Author: Marcus Meissner <marcus at jet.franken.de>
Date:   Fri Aug 17 22:36:48 2012 +0200

quartz: Avoid linked list walk with free next (Coverity).

---

 dlls/quartz/systemclock.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/dlls/quartz/systemclock.c b/dlls/quartz/systemclock.c
index 842541b..043299b 100644
--- a/dlls/quartz/systemclock.c
+++ b/dlls/quartz/systemclock.c
@@ -116,12 +116,15 @@ static DWORD WINAPI SystemClockAdviseThread(LPVOID lpParam) {
     }
 
     /** First SingleShots Advice: sorted list */
-    for (it = This->pSingleShotAdvise; NULL != it && (it->rtBaseTime + it->rtIntervalTime) <= curTime; it = it->next) {
+    it = This->pSingleShotAdvise;
+    while ((NULL != it) && (it->rtBaseTime + it->rtIntervalTime) <= curTime) {
+      SystemClockAdviseEntry* nextit = it->next;
       /** send event ... */
       SetEvent(it->hEvent);
       /** ... and Release it */
       QUARTZ_RemoveAviseEntryFromQueue(This, it);
       CoTaskMemFree(it);
+      it = nextit;
     }
     if (NULL != it) timeOut = (DWORD) ((it->rtBaseTime + it->rtIntervalTime) - curTime) / (REFERENCE_TIME)10000;
 




More information about the wine-cvs mailing list