libwinpr-utils/queue: fix a memory corruption in Queue_Clear.
authorVic Lee <llyzs@163.com>
Mon, 24 Dec 2012 04:45:55 +0000 (12:45 +0800)
committerVic Lee <llyzs@163.com>
Mon, 24 Dec 2012 04:45:55 +0000 (12:45 +0800)
winpr/libwinpr/utils/collections/Queue.c

index 279b848..2135ae5 100644 (file)
@@ -85,7 +85,7 @@ void Queue_Clear(wQueue* queue)
        if (queue->synchronized)
                WaitForSingleObject(queue->mutex, INFINITE);
 
-       for (index = queue->head; index != queue->tail; index++)
+       for (index = queue->head; index != queue->tail; index = (index + 1) % queue->capacity)
        {
                if (queue->object.fnObjectFree)
                        queue->object.fnObjectFree(queue->array[index]);