Commit 3bdd4a655b for openssl.org
commit 3bdd4a655bd707f66a7ea620ffae88afc3e15fa7
Author: Bernd Edlinger <bernd.edlinger@hotmail.de>
Date: Sat Sep 12 12:20:18 2026 +0200
Fix a memory leak in apps/ocsp.c issuer
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Merge-date: Tue Sep 15 16:28:52 2026
Merged-from: https://github.com/openssl/openssl/pull/32807
diff --git a/apps/ocsp.c b/apps/ocsp.c
index 59d33e90f2..e302c1cf6b 100644
--- a/apps/ocsp.c
+++ b/apps/ocsp.c
@@ -470,11 +470,15 @@ int ocsp_main(int argc, char **argv)
if (issuer == NULL)
goto end;
if (issuers == NULL) {
- if ((issuers = sk_X509_new_null()) == NULL)
+ if ((issuers = sk_X509_new_null()) == NULL) {
+ X509_free(issuer);
goto end;
+ }
}
- if (!sk_X509_push(issuers, issuer))
+ if (!sk_X509_push(issuers, issuer)) {
+ X509_free(issuer);
goto end;
+ }
break;
case OPT_CERT:
reset_unknown();