Fixed allocation size warning.
authorArmin Novak <armin.novak@gmail.com>
Sun, 16 Nov 2014 22:43:18 +0000 (23:43 +0100)
committerArmin Novak <armin.novak@gmail.com>
Sun, 16 Nov 2014 22:43:18 +0000 (23:43 +0100)
winpr/libwinpr/utils/collections/ListDictionary.c

index 918bee4..a0690d8 100644 (file)
@@ -122,7 +122,7 @@ int ListDictionary_GetKeys(wListDictionary* listDictionary, ULONG_PTR** ppKeys)
 {
        int index;
        int count;
-       ULONG_PTR* pKeys;
+       ULONG_PTR* pKeys = NULL;
        wListDictionaryItem* item;
 
        if (!ppKeys)
@@ -144,7 +144,8 @@ int ListDictionary_GetKeys(wListDictionary* listDictionary, ULONG_PTR** ppKeys)
                }
        }
 
-       pKeys = (ULONG_PTR*) calloc(count, sizeof(ULONG_PTR));
+       if (count)
+               pKeys = (ULONG_PTR*) calloc(count, sizeof(ULONG_PTR));
 
        index = 0;