提交 5b442029 编写于 作者: A Alper Akcan

fix memory leak in cJSON_Duplicate

上级 e1eb06fa
...@@ -2153,7 +2153,7 @@ cJSON *cJSON_Duplicate(const cJSON *item, cjbool recurse) ...@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册