From: Marc Brooks Date: Tue, 30 Jul 2024 20:29:34 +0000 (-0500) Subject: Free fetched digest in show_digests X-Git-Tag: openssl-3.1.7~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1cc4235bd28073352cafee0f64b3669d581ccf1e;p=thirdparty%2Fopenssl.git Free fetched digest in show_digests Fixes #24892 Reviewed-by: Paul Dale Reviewed-by: Shane Lontis Reviewed-by: Tom Cosgrove Reviewed-by: Neil Horman (Merged from https://github.com/openssl/openssl/pull/25046) (cherry picked from commit 871c534d39efecc2087da0fd24ff72e2712031a4) --- diff --git a/apps/dgst.c b/apps/dgst.c index 3f02af0d573..d15ad65ef82 100644 --- a/apps/dgst.c +++ b/apps/dgst.c @@ -478,7 +478,7 @@ int dgst_main(int argc, char **argv) static void show_digests(const OBJ_NAME *name, void *arg) { struct doall_dgst_digests *dec = (struct doall_dgst_digests *)arg; - const EVP_MD *md = NULL; + EVP_MD *md = NULL; /* Filter out signed digests (a.k.a signature algorithms) */ if (strstr(name->name, "rsa") != NULL || strstr(name->name, "RSA") != NULL) @@ -490,8 +490,7 @@ static void show_digests(const OBJ_NAME *name, void *arg) /* Filter out message digests that we cannot use */ md = EVP_MD_fetch(app_get0_libctx(), name->name, app_get0_propq()); if (md == NULL) { - md = EVP_get_digestbyname(name->name); - if (md == NULL) + if (EVP_get_digestbyname(name->name) == NULL) return; } @@ -502,6 +501,8 @@ static void show_digests(const OBJ_NAME *name, void *arg) } else { BIO_printf(dec->bio, " "); } + + EVP_MD_free(md); } /*