From 4dd1d0abd34a382d1cd67cabb737950a39cb3fdc Mon Sep 17 00:00:00 2001 From: Andre Heinecke Date: Wed, 8 Aug 2018 14:27:24 +0200 Subject: [PATCH] json: Wipe memory in cJSON_Delete * src/cJSON.c (cJSON_Delete): Wipe memory on deletion. --- src/cJSON.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/cJSON.c b/src/cJSON.c index 4da03ccc..9e53012e 100644 --- a/src/cJSON.c +++ b/src/cJSON.c @@ -123,9 +123,15 @@ cJSON_Delete (cJSON * c) if (!(c->type & cJSON_IsReference) && c->child) cJSON_Delete (c->child); if (!(c->type & cJSON_IsReference) && c->valuestring) - xfree (c->valuestring); + { + wipememory (c->valuestring, strlen (c->valuestring)); + xfree (c->valuestring); + } if (c->string) - xfree (c->string); + { + wipememory (c->string, strlen (c->string)); + xfree (c->string); + } xfree (c); c = next; }