mirror of https://github.com/FreeRDP/FreeRDP
Fixed missing checks for queue functions
This commit is contained in:
parent
6c859b4579
commit
4daa09c3e5
|
@ -268,7 +268,8 @@ void MessageQueue_Free(wMessageQueue* queue)
|
|||
if (!queue)
|
||||
return;
|
||||
|
||||
MessageQueue_Clear(queue);
|
||||
if (queue->event)
|
||||
MessageQueue_Clear(queue);
|
||||
|
||||
CloseHandle(queue->event);
|
||||
DeleteCriticalSection(&queue->lock);
|
||||
|
|
|
@ -40,6 +40,7 @@ struct _wQueue
|
|||
HANDLE event;
|
||||
|
||||
wObject object;
|
||||
BOOL haveLock;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -283,6 +284,9 @@ wQueue* Queue_New(BOOL synchronized, SSIZE_T capacity, SSIZE_T growthFactor)
|
|||
|
||||
if (capacity <= 0)
|
||||
capacity = 32;
|
||||
if (!InitializeCriticalSectionAndSpinCount(&queue->lock, 4000))
|
||||
goto fail;
|
||||
queue->haveLock = TRUE;
|
||||
if (!Queue_EnsureCapacity(queue, (size_t)capacity))
|
||||
goto fail;
|
||||
|
||||
|
@ -291,9 +295,6 @@ wQueue* Queue_New(BOOL synchronized, SSIZE_T capacity, SSIZE_T growthFactor)
|
|||
if (!queue->event)
|
||||
goto fail;
|
||||
|
||||
if (!InitializeCriticalSectionAndSpinCount(&queue->lock, 4000))
|
||||
goto fail;
|
||||
|
||||
obj = Queue_Object(queue);
|
||||
obj->fnObjectEquals = default_queue_equals;
|
||||
|
||||
|
@ -308,9 +309,12 @@ void Queue_Free(wQueue* queue)
|
|||
if (!queue)
|
||||
return;
|
||||
|
||||
Queue_Clear(queue);
|
||||
if (queue->haveLock)
|
||||
{
|
||||
Queue_Clear(queue);
|
||||
DeleteCriticalSection(&queue->lock);
|
||||
}
|
||||
CloseHandle(queue->event);
|
||||
DeleteCriticalSection(&queue->lock);
|
||||
free(queue->array);
|
||||
free(queue);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue