summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorNeil Horman <nhorman@openssl.org>2024-02-02 08:20:50 -0500
committerTomas Mraz <tomas@openssl.org>2024-05-06 16:17:14 +0200
commit27504de59586a23862f2f29e0d640b51d43ff24a (patch)
tree8f98654e2cc327fa3056756009345eee5cfcd875 /crypto
parent287165f1b7ce0193378b9365e675edd69fc289c4 (diff)
Coverity found the following issues:
1591471 1591474 1591476 which pertain to memory leaks in the conf_mod code If an error is encountered after the module STACK_OF is duplicated or created in the new_modules variable, we need to remember to free it in the error path Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Paul Dale <ppzgs1@gmail.com> (Merged from https://github.com/openssl/openssl/pull/24337)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/conf/conf_mod.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/crypto/conf/conf_mod.c b/crypto/conf/conf_mod.c
index 7efb982054..a19575af37 100644
--- a/crypto/conf/conf_mod.c
+++ b/crypto/conf/conf_mod.c
@@ -368,6 +368,7 @@ static CONF_MODULE *module_add(DSO *dso, const char *name,
err:
ossl_rcu_write_unlock(module_list_lock);
+ sk_CONF_MODULE_free(new_modules);
if (tmod != NULL) {
OPENSSL_free(tmod->name);
OPENSSL_free(tmod);
@@ -466,6 +467,7 @@ static int module_init(CONF_MODULE *pmod, const char *name, const char *value,
if (!sk_CONF_IMODULE_push(new_modules, imod)) {
ossl_rcu_write_unlock(module_list_lock);
+ sk_CONF_IMODULE_free(new_modules);
ERR_raise(ERR_LIB_CONF, ERR_R_CRYPTO_LIB);
goto err;
}