From 25d52dde3f7d3308b48d25da37d3ded1ddd3dc2e Mon Sep 17 00:00:00 2001 From: JacobBarthelmeh Date: Fri, 5 Jul 2024 11:56:45 -0600 Subject: [PATCH] fix coverity issue 367842 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 06f8b84f91..9c30e84383 100644 --- a/src/ssl_load.c +++ b/src/ssl_load.c @@ -5264,7 +5264,7 @@ int wolfSSL_SetTmpDH(WOLFSSL* ssl, const unsigned char* p, int pSz, ret = wolfssl_set_tmp_dh(ssl, pAlloc, pSz, gAlloc, gSz); } - if (ret != 1) { + if (ret != 1 && ssl != NULL) { /* Free the allocated buffers if not assigned into SSL. */ XFREE(pAlloc, ssl->heap, DYNAMIC_TYPE_PUBLIC_KEY); XFREE(gAlloc, ssl->heap, DYNAMIC_TYPE_PUBLIC_KEY);