fix potential NULL dereferences found by coverity

This commit is contained in:
Max Bruckner committed 2017-02-08 03:00:44 +01:00
1 parent 49b9336558
commit 4047de4f6e
2 files changed
+6 -1

No files matched your search

+1 -1
View File
@@ -277,7 +277,7 @@ static cJSON *cJSONUtils_PatchDetach(cJSON *object, const unsigned char *path)
static int cJSONUtils_Compare(cJSON *a, cJSON *b)
{
if ((a->type & 0xFF) != (b->type & 0xFF))
if ((a == NULL) || (b == NULL) || ((a->type & 0xFF) != (b->type & 0xFF)))
{
/* mismatched type. */
return -1;