cJSON_Utils: Fix potential null pointer dereference

Found by coverity
This commit is contained in:
Max Bruckner 2017-04-05 17:36:25 +02:00
parent 2683d4d987
commit 795c3acabe

View File

@ -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);