json: Wipe memory in cJSON_Delete

* src/cJSON.c (cJSON_Delete): Wipe memory on deletion.
This commit is contained in:
Andre Heinecke 2018-08-08 14:27:24 +02:00
parent fdc07b3ddc
commit 4dd1d0abd3
No known key found for this signature in database
GPG Key ID: 2978E9D40CBABA5C

View File

@ -123,9 +123,15 @@ cJSON_Delete (cJSON * c)
if (!(c->type & cJSON_IsReference) && c->child) if (!(c->type & cJSON_IsReference) && c->child)
cJSON_Delete (c->child); cJSON_Delete (c->child);
if (!(c->type & cJSON_IsReference) && c->valuestring) if (!(c->type & cJSON_IsReference) && c->valuestring)
xfree (c->valuestring); {
wipememory (c->valuestring, strlen (c->valuestring));
xfree (c->valuestring);
}
if (c->string) if (c->string)
xfree (c->string); {
wipememory (c->string, strlen (c->string));
xfree (c->string);
}
xfree (c); xfree (c);
c = next; c = next;
} }