fix #106: potentially invalid free in cJSON_AddItemToObject

This commit is contained in:
Max Bruckner 2017-02-15 20:45:23 +01:00
parent 94117a5d23
commit 702fd95af3
1 changed files with 1 additions and 1 deletions

View File

@ -1771,7 +1771,7 @@ void cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item)
}
/* free old key and set new one */
if (item->string)
if (!(item->type & cJSON_StringIsConst) && item->string)
{
cJSON_free(item->string);
}