提交 eeb6d237 编写于 作者: M Max Bruckner 提交者: GitHub

Merge pull request #81 from alperakcan/master

fix memory leak in cJSON_Duplicate
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册