Merge pull request #519 from Alanscut/issue-516

fix a possible dereference of null pointer
This commit is contained in:
Alan Wang 2020-10-16 17:12:54 +08:00 committed by GitHub
commit a1e1c208ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

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