mirror of
https://github.com/DaveGamble/cJSON.git
synced 2023-08-10 21:13:26 +03:00
Merge pull request #81 from alperakcan/master
fix memory leak in cJSON_Duplicate
This commit is contained in:
commit
eeb6d237b6
2
cJSON.c
2
cJSON.c
@ -2153,7 +2153,7 @@ cJSON *cJSON_Duplicate(const cJSON *item, cjbool recurse)
|
|||||||
}
|
}
|
||||||
if (item->string)
|
if (item->string)
|
||||||
{
|
{
|
||||||
newitem->string = cJSON_strdup(item->string);
|
newitem->string = (item->type&cJSON_StringIsConst) ? item->string : cJSON_strdup(item->string);
|
||||||
if (!newitem->string)
|
if (!newitem->string)
|
||||||
{
|
{
|
||||||
cJSON_Delete(newitem);
|
cJSON_Delete(newitem);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user