From f8eb0c3776f33ca3201ab43263a5d81ffa6911e8 Mon Sep 17 00:00:00 2001 From: JacobBarthelmeh Date: Fri, 5 Jul 2024 14:06:19 -0600 Subject: [PATCH] fix for coverity issue 394676 possible null dereference --- src/ssl_load.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ssl_load.c b/src/ssl_load.c index 9c30e84383..2441d485e6 100644 --- a/src/ssl_load.c +++ b/src/ssl_load.c @@ -5496,7 +5496,7 @@ long wolfSSL_set_tmp_dh(WOLFSSL *ssl, WOLFSSL_DH *dh) ret = wolfssl_set_tmp_dh(ssl, p, pSz, g, gSz); } - if (ret != 1) { + if (ret != 1 && ssl != NULL) { /* Free the allocated buffers if not assigned into SSL. */ XFREE(p, ssl->heap, DYNAMIC_TYPE_PUBLIC_KEY); XFREE(g, ssl->heap, DYNAMIC_TYPE_PUBLIC_KEY);