Browse Source

cJSON_Utils: Fix potential null pointer dereference

Found by coverity
Max Bruckner 8 years ago
parent
commit
795c3acabe
1 changed files with 1 additions and 1 deletions
  1. 1 1
      cJSON_Utils.c

+ 1 - 1
cJSON_Utils.c

@@ -468,7 +468,7 @@ static int cJSONUtils_ApplyPatch(cJSON *object, cJSON *patch)
     cJSONUtils_InplaceDecodePointerString(childptr);
 
     /* add, remove, replace, move, copy, test. */
-    if (!parent)
+    if ((parent == NULL) || (childptr == NULL))
     {
         /* Couldn't find object to add to. */
         free(parentptr);