mirror of
https://github.com/DaveGamble/cJSON.git
synced 2023-08-10 21:13:26 +03:00
fix potential NULL dereferences found by coverity
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user