[PATCH] quartz: avoid linked list walk with free next (Coverity)
Marcus Meissner
marcus at jet.franken.de
Fri Aug 17 15:36:48 CDT 2012
store the next pointer was we might free it.
CID 714101
Ciao, Marcus
---
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..a21a9a0 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;
--
1.7.3.4
More information about the wine-patches
mailing list