From a31d8c5ce7a93e2ae3985a948f56b257d274b5e1 Mon Sep 17 00:00:00 2001 From: Andras Fekete Date: Wed, 7 Aug 2024 11:14:15 -0400 Subject: [PATCH] Addressing PR comments --- src/ssl.c | 4 +++- src/x509.c | 4 +++- wolfcrypt/src/evp.c | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/ssl.c b/src/ssl.c index e1cb59896..afd505027 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -13566,7 +13566,9 @@ WOLFSSL_STACK* wolfSSL_sk_new_node(void* heap) /* free's node but does not free internal data such as in->data.x509 */ void wolfSSL_sk_free_node(WOLFSSL_STACK* in) { - XFREE(in, in->heap, DYNAMIC_TYPE_OPENSSL); + if (in != NULL) { + XFREE(in, in->heap, DYNAMIC_TYPE_OPENSSL); + } } /* pushes node "in" onto "stack" and returns pointer to the new stack on success diff --git a/src/x509.c b/src/x509.c index e34e6b7ab..2e443a023 100644 --- a/src/x509.c +++ b/src/x509.c @@ -9684,7 +9684,9 @@ WOLF_STACK_OF(WOLFSSL_X509)* wolfSSL_X509_chain_up_ref( { WOLFSSL_ENTER("wolfSSL_X509_NAME_free"); FreeX509Name(name); - XFREE(name, name->heap, DYNAMIC_TYPE_X509); + if (name != NULL) { + XFREE(name, name->heap, DYNAMIC_TYPE_X509); + } } diff --git a/wolfcrypt/src/evp.c b/wolfcrypt/src/evp.c index 813a4a275..8b78f620c 100644 --- a/wolfcrypt/src/evp.c +++ b/wolfcrypt/src/evp.c @@ -12282,7 +12282,9 @@ struct WOLFSSL_EVP_ENCODE_CTX* wolfSSL_EVP_ENCODE_CTX_new(void) void wolfSSL_EVP_ENCODE_CTX_free(WOLFSSL_EVP_ENCODE_CTX* ctx) { WOLFSSL_ENTER("wolfSSL_EVP_ENCODE_CTX_free"); - XFREE(ctx, ctx->heap, DYNAMIC_TYPE_OPENSSL); + if (ctx != NULL) { + XFREE(ctx, ctx->heap, DYNAMIC_TYPE_OPENSSL); + } } #endif /* WOLFSSL_BASE64_ENCODE || WOLFSSL_BASE64_DECODE */ #if defined(WOLFSSL_BASE64_ENCODE)