diff options
-rw-r--r-- | nx-X11/programs/Xserver/Xext/sync.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/nx-X11/programs/Xserver/Xext/sync.c b/nx-X11/programs/Xserver/Xext/sync.c index 7fa6145a6..48b142f82 100644 --- a/nx-X11/programs/Xserver/Xext/sync.c +++ b/nx-X11/programs/Xserver/Xext/sync.c @@ -296,14 +296,18 @@ static void SyncDeleteTriggerFromCounter(pTrigger) SyncTrigger *pTrigger; { - SyncTriggerList *pCur, *pPrev = NULL; + SyncTriggerList *pCur; + SyncTriggerList *pPrev; /* pCounter needs to be stored in pTrigger before calling here. */ if (!pTrigger->pCounter) return; - for (pCur = pTrigger->pCounter->pTriglist; pCur; pCur = pCur->next) + pPrev = NULL; + pCur = pTrigger->pCounter->pTriglist; + + while (pCur) { if (pCur->pTrigger == pTrigger) { @@ -311,9 +315,14 @@ SyncDeleteTriggerFromCounter(pTrigger) pPrev->next = pCur->next; else pTrigger->pCounter->pTriglist = pCur->next; + + xfree(pCur); free(pCur); break; } + + pPrev = pCur; + pCur = pCur->next; } if (IsSystemCounter(pTrigger->pCounter)) |