Browse Source

cJSON_Utils: Fix potential null pointer dereference

Found by coverity
Max Bruckner 8 năm trước cách đây
mục cha
commit
795c3acabe
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  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);