diff options
author | Bernd Edlinger <bernd.edlinger@hotmail.de> | 2021-12-08 14:14:48 +0100 |
---|---|---|
committer | Bernd Edlinger <bernd.edlinger@hotmail.de> | 2021-12-09 19:24:30 +0100 |
commit | c50bf14450f3cd242f2211ca7e500191053d8050 (patch) | |
tree | 696cb019bbb598d313a3957ac9105a28ba50fa0b /crypto/objects | |
parent | f0d5a3b6ea1bbe4e5dac5b69d853c015db635621 (diff) |
Minor code cleanup in o_names_init
This might result in a small memory leak.
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17238)
Diffstat (limited to 'crypto/objects')
-rw-r--r-- | crypto/objects/o_names.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/crypto/objects/o_names.c b/crypto/objects/o_names.c index 05aa8c44aa..92152eeb66 100644 --- a/crypto/objects/o_names.c +++ b/crypto/objects/o_names.c @@ -66,8 +66,14 @@ static int obj_name_cmp(const OBJ_NAME *a, const OBJ_NAME *b); static CRYPTO_ONCE init = CRYPTO_ONCE_STATIC_INIT; DEFINE_RUN_ONCE_STATIC(o_names_init) { - names_lh = lh_OBJ_NAME_new(obj_name_hash, obj_name_cmp); + names_lh = NULL; obj_lock = CRYPTO_THREAD_lock_new(); + if (obj_lock != NULL) + names_lh = lh_OBJ_NAME_new(obj_name_hash, obj_name_cmp); + if (names_lh == NULL) { + CRYPTO_THREAD_lock_free(obj_lock); + obj_lock = NULL; + } return names_lh != NULL && obj_lock != NULL; } |