plug potential memory leak in error code path

Function `module_add()` may leak stack of modules when
it fails to initialize newly added module.

Fixes #23835

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23836)
This commit is contained in:
Alexandr Nedvedicky 2024-03-14 09:53:56 +01:00 committed by Tomas Mraz
parent 12f5f26e1e
commit 707b54bee2

View File

@ -372,6 +372,7 @@ static CONF_MODULE *module_add(DSO *dso, const char *name,
OPENSSL_free(tmod->name);
OPENSSL_free(tmod);
}
sk_CONF_MODULE_free(new_modules);
return NULL;
}