diff options
author | shridhar kalavagunta <coolshrid@hotmail.com> | 2024-04-11 20:42:37 -0500 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2024-06-05 13:16:19 +0200 |
commit | 026b0d3e1e7667ccc5a9d67bd9bd99a404563369 (patch) | |
tree | 112ea3242d87a6ac279d5f00c6ced10c31a2caf7 | |
parent | f56083e236c1f4bf4414a9d4ad1efe5c610b2116 (diff) |
Fix memory leak on error in crypto/conf/conf_mod.c
Fixes #24111
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24119)
(cherry picked from commit 5bbdbce856c7ca132e039a24a315618484874c81)
-rw-r--r-- | crypto/conf/conf_mod.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/conf/conf_mod.c b/crypto/conf/conf_mod.c index a19575af37..ca87315012 100644 --- a/crypto/conf/conf_mod.c +++ b/crypto/conf/conf_mod.c @@ -518,13 +518,14 @@ void CONF_modules_unload(int all) old_modules = ossl_rcu_deref(&supported_modules); new_modules = sk_CONF_MODULE_dup(old_modules); - to_delete = sk_CONF_MODULE_new_null(); if (new_modules == NULL) { ossl_rcu_write_unlock(module_list_lock); return; } + to_delete = sk_CONF_MODULE_new_null(); + /* unload modules in reverse order */ for (i = sk_CONF_MODULE_num(new_modules) - 1; i >= 0; i--) { md = sk_CONF_MODULE_value(new_modules, i); |