From: Bernd Edlinger Date: Mon, 22 Jan 2024 15:02:59 +0000 (+0100) Subject: Fix a possible memory leak in req_main X-Git-Tag: openssl-3.1.5~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=96014134630799ee5879ed94b6450e860ba4ebfe;p=thirdparty%2Fopenssl.git Fix a possible memory leak in req_main if the private key is output to stdout using the HARNESS_OSSL_PREFIX, out is a stack of BIOs and must therefore free'd using BIO_free_all. Steps to reproduce: $ HARNESS_OSSL_PREFIX=x OPENSSL_CONF=apps/openssl.cnf util/shlib_wrap.sh apps/openssl req -new -keyout - -passout pass: Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/23365) (cherry picked from commit ff78d94b131d7bb3b761509d3ce0dd864b1420e3) --- diff --git a/apps/req.c b/apps/req.c index 41191803aef..a201e36746d 100644 --- a/apps/req.c +++ b/apps/req.c @@ -733,7 +733,7 @@ int req_main(int argc, char **argv) } goto end; } - BIO_free(out); + BIO_free_all(out); out = NULL; BIO_printf(bio_err, "-----\n"); }