From 166330030ca19a984ba3448d64c5cb8c90cdc5dd Mon Sep 17 00:00:00 2001 From: kaleb-himes Date: Sun, 29 Jul 2018 06:46:07 -0600 Subject: [PATCH] Handle case where external unassigned --- wolfcrypt/src/logging.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wolfcrypt/src/logging.c b/wolfcrypt/src/logging.c index 40c9fe969..cfdf1eaf1 100644 --- a/wolfcrypt/src/logging.c +++ b/wolfcrypt/src/logging.c @@ -580,6 +580,11 @@ int wc_AddErrorNode(int error, int line, char* buf, char* file) if (wc_errors != NULL) { /* check for unexpected case before over writing wc_errors */ WOLFSSL_MSG("ERROR in adding new node to logging queue!!\n"); + /* In the event both wc_last_node and wc_errors are NULL, err + * goes unassigned to external wc_errors, wc_last_node. Free + * err in this instance since wc_ClearErrorNodes will not + */ + XFREE(err, wc_error_heap, DYNAMIC_TYPE_LOG); } else { wc_errors = err;