mirror of
https://github.com/DaveGamble/cJSON.git
synced 2023-08-10 21:13:26 +03:00
fix #106: potentially invalid free in cJSON_AddItemToObject
This commit is contained in:
parent
94117a5d23
commit
702fd95af3
2
cJSON.c
2
cJSON.c
@ -1771,7 +1771,7 @@ void cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* free old key and set new one */
|
/* free old key and set new one */
|
||||||
if (item->string)
|
if (!(item->type & cJSON_StringIsConst) && item->string)
|
||||||
{
|
{
|
||||||
cJSON_free(item->string);
|
cJSON_free(item->string);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user