From 9bf4960cd525428ddbfb9b13f39c4269083b18d7 Mon Sep 17 00:00:00 2001 From: Alanscut Date: Fri, 16 Oct 2020 17:06:29 +0800 Subject: [PATCH] fix a possible dereference of null pointer --- cJSON_Utils.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cJSON_Utils.c b/cJSON_Utils.c index f4ad32a..8e70e00 100644 --- a/cJSON_Utils.c +++ b/cJSON_Utils.c @@ -1406,6 +1406,10 @@ static cJSON *generate_merge_patch(cJSON * const from, cJSON * const to, const c from_child = from->child; to_child = to->child; patch = cJSON_CreateObject(); + if (patch == NULL) + { + return NULL; + } while (from_child || to_child) { int diff;