mirror of
https://github.com/DaveGamble/cJSON.git
synced 2026-11-16 19:20:52 +00:00
fix memory leak in cJSON_Duplicate
This commit is contained in:
1 parent
e1eb06fae0
commit
5b4420298f
1 file changed
+1
-1
@@ -2153,7 +2153,7 @@ cJSON *cJSON_Duplicate(const cJSON *item, cjbool recurse)
|
||||
}
|
||||
if (item->string)
|
||||
{
|
||||
newitem->string = cJSON_strdup(item->string);
|
||||
newitem->string = (item->type&cJSON_StringIsConst) ? item->string : cJSON_strdup(item->string);
|
||||
if (!newitem->string)
|
||||
{
|
||||
cJSON_Delete(newitem);
|
||||
|
||||
Reference in new issue
Block a user