From 795c3acabed25c9672006b2c0f40be8845064827 Mon Sep 17 00:00:00 2001 From: Max Bruckner Date: Wed, 5 Apr 2017 17:36:25 +0200 Subject: [PATCH] cJSON_Utils: Fix potential null pointer dereference Found by coverity --- cJSON_Utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cJSON_Utils.c b/cJSON_Utils.c index 8fe4ff0..b39e432 100644 --- a/cJSON_Utils.c +++ b/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);