From afb2180e806520e00c3585799af03f9a6f4ea022 Mon Sep 17 00:00:00 2001 From: kaleb-himes Date: Fri, 27 Jul 2018 14:00:19 -0600 Subject: [PATCH 1/3] Cleanup debug errors --- wolfcrypt/src/logging.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wolfcrypt/src/logging.c b/wolfcrypt/src/logging.c index fb7d46298..40c9fe969 100644 --- a/wolfcrypt/src/logging.c +++ b/wolfcrypt/src/logging.c @@ -641,7 +641,10 @@ void wc_RemoveErrorNode(int idx) */ void wc_ClearErrorNodes(void) { -#if defined(DEBUG_WOLFSSL) || defined(WOLFSSL_NGINX) +#if defined(DEBUG_WOLFSSL) || defined(WOLFSSL_NGINX) || \ + defined(OPENSSL_ALL) || defined(DEBUG_WOLFSSL_VERBOSE) || \ + defined(WOLFSSL_HAPROXY) + if (wc_LockMutex(&debug_mutex) != 0) { WOLFSSL_MSG("Lock debug mutex failed"); return; From 166330030ca19a984ba3448d64c5cb8c90cdc5dd Mon Sep 17 00:00:00 2001 From: kaleb-himes Date: Sun, 29 Jul 2018 06:46:07 -0600 Subject: [PATCH 2/3] 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; From fe08b9811726617f5a70188411fe1adf4cad58f7 Mon Sep 17 00:00:00 2001 From: kaleb-himes Date: Tue, 31 Jul 2018 09:50:44 -0600 Subject: [PATCH 3/3] Adjust guards following peer review --- wolfcrypt/src/logging.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/wolfcrypt/src/logging.c b/wolfcrypt/src/logging.c index cfdf1eaf1..d620bcf4f 100644 --- a/wolfcrypt/src/logging.c +++ b/wolfcrypt/src/logging.c @@ -647,8 +647,7 @@ void wc_RemoveErrorNode(int idx) void wc_ClearErrorNodes(void) { #if defined(DEBUG_WOLFSSL) || defined(WOLFSSL_NGINX) || \ - defined(OPENSSL_ALL) || defined(DEBUG_WOLFSSL_VERBOSE) || \ - defined(WOLFSSL_HAPROXY) + defined(OPENSSL_EXTRA) || defined(DEBUG_WOLFSSL_VERBOSE) if (wc_LockMutex(&debug_mutex) != 0) { WOLFSSL_MSG("Lock debug mutex failed");