Merge pull request #415 from Alanscut/fix_issue_414

fix memory leak mentioned in issue 414
This commit is contained in:
Alanscut 2019-12-05 11:13:20 +08:00 committed by GitHub
commit 8badd19b64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -216,6 +216,7 @@ CJSON_PUBLIC(char *) cJSONUtils_FindPointerFromObjectTo(const cJSON * const obje
if (child_index > ULONG_MAX)
{
cJSON_free(target_pointer);
cJSON_free(full_pointer);
return NULL;
}
sprintf((char*)full_pointer, "/%lu%s", (unsigned long)child_index, target_pointer); /* /<array_index><path> */