From 7cc69ec4cf575232040ac776f405fb31f030e59a Mon Sep 17 00:00:00 2001 From: Norbert Pocs Date: Wed, 14 May 2025 14:50:42 +0200 Subject: [PATCH] configutl.c: Resolve possible resource leak of config file MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The coverity detects Resource leak here. It may come to leak when the option is passed multiple times. Resolve coverity scan issue 1646846 Signed-off-by: Norbert Pocs Reviewed-by: Saša Nedvědický Reviewed-by: Neil Horman Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/27623) --- apps/configutl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/configutl.c b/apps/configutl.c index 81bcf9d7895..2ee27962790 100644 --- a/apps/configutl.c +++ b/apps/configutl.c @@ -131,6 +131,11 @@ int configutl_main(int argc, char *argv[]) no_header = 1; break; case OPT_CONFIG: + /* + * In case multiple OPT_CONFIG options are passed, we need to free + * the previous one before assigning the new one. + */ + OPENSSL_free(configfile); configfile = OPENSSL_strdup(opt_arg()); break; case OPT_OUT: -- 2.47.2