From c6f41bce2f786e654d90bbe9158f8b287c703c52 Mon Sep 17 00:00:00 2001 From: Juliusz Sosinowicz Date: Mon, 16 Mar 2026 14:55:07 +0100 Subject: [PATCH] Fix memory leak on hash failure in LoadCertByIssuer F-721 --- src/internal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/internal.c b/src/internal.c index 2298423440..ce82d0f0be 100644 --- a/src/internal.c +++ b/src/internal.c @@ -14957,6 +14957,7 @@ int LoadCertByIssuer(WOLFSSL_X509_STORE* store, X509_NAME* issuer, int type) #elif !defined(NO_SHA) retHash = wc_ShaHash((const byte*)pbuf, (word32)len, dgt); #endif + wolfSSL_OPENSSL_free(pbuf); if (retHash == 0) { /* 4 bytes in little endian as unsigned long */ hash = (((unsigned long)dgt[3] << 24) | @@ -14967,7 +14968,6 @@ int LoadCertByIssuer(WOLFSSL_X509_STORE* store, X509_NAME* issuer, int type) WOLFSSL_MSG("failed hash operation"); return WOLFSSL_FAILURE; } - wolfSSL_OPENSSL_free(pbuf); } /* try to load each hashed name file in path */