diff --git a/winpr/libwinpr/utils/collections/ArrayList.c b/winpr/libwinpr/utils/collections/ArrayList.c index c30cc96f0..6d507ca1d 100644 --- a/winpr/libwinpr/utils/collections/ArrayList.c +++ b/winpr/libwinpr/utils/collections/ArrayList.c @@ -470,6 +470,9 @@ out_free: void ArrayList_Free(wArrayList *arrayList) { + if (!arrayList) + return; + ArrayList_Clear(arrayList); DeleteCriticalSection(&arrayList->lock); free(arrayList->array); diff --git a/winpr/libwinpr/utils/collections/BitStream.c b/winpr/libwinpr/utils/collections/BitStream.c index 26e739cd5..8dfb776d9 100644 --- a/winpr/libwinpr/utils/collections/BitStream.c +++ b/winpr/libwinpr/utils/collections/BitStream.c @@ -348,5 +348,8 @@ wBitStream* BitStream_New() void BitStream_Free(wBitStream* bs) { + if (!bs) + return; + free(bs); } diff --git a/winpr/libwinpr/utils/collections/CountdownEvent.c b/winpr/libwinpr/utils/collections/CountdownEvent.c index a29121a88..fabaa8d3d 100644 --- a/winpr/libwinpr/utils/collections/CountdownEvent.c +++ b/winpr/libwinpr/utils/collections/CountdownEvent.c @@ -182,6 +182,9 @@ fail_critical_section: void CountdownEvent_Free(wCountdownEvent* countdown) { + if (!countdown) + return; + DeleteCriticalSection(&countdown->lock); CloseHandle(countdown->event); diff --git a/winpr/libwinpr/utils/collections/Dictionary.c b/winpr/libwinpr/utils/collections/Dictionary.c index 0cb5b8bcd..8f932782c 100644 --- a/winpr/libwinpr/utils/collections/Dictionary.c +++ b/winpr/libwinpr/utils/collections/Dictionary.c @@ -128,6 +128,9 @@ wDictionary* Dictionary_New(BOOL synchronized) void Dictionary_Free(wDictionary* dictionary) { + if (!dictionary) + return; + free(dictionary); } diff --git a/winpr/libwinpr/utils/collections/KeyValuePair.c b/winpr/libwinpr/utils/collections/KeyValuePair.c index 488583101..19a211e73 100644 --- a/winpr/libwinpr/utils/collections/KeyValuePair.c +++ b/winpr/libwinpr/utils/collections/KeyValuePair.c @@ -46,5 +46,8 @@ wKeyValuePair* KeyValuePair_New(void* key, void* value) void KeyValuePair_Free(wKeyValuePair* keyValuePair) { + if (!keyValuePair) + return; + free(keyValuePair); } diff --git a/winpr/libwinpr/utils/collections/MessageQueue.c b/winpr/libwinpr/utils/collections/MessageQueue.c index a1fc39b84..e902562d9 100644 --- a/winpr/libwinpr/utils/collections/MessageQueue.c +++ b/winpr/libwinpr/utils/collections/MessageQueue.c @@ -223,6 +223,9 @@ error_array: void MessageQueue_Free(wMessageQueue* queue) { + if (!queue) + return; + CloseHandle(queue->event); DeleteCriticalSection(&queue->lock);