diff options
Diffstat (limited to 'crypto/objects')
-rw-r--r-- | crypto/objects/o_names.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/crypto/objects/o_names.c b/crypto/objects/o_names.c index fbc756ebb8..372f65d1ff 100644 --- a/crypto/objects/o_names.c +++ b/crypto/objects/o_names.c @@ -86,7 +86,8 @@ int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *), if (!OBJ_NAME_init()) return 0; - CRYPTO_THREAD_write_lock(obj_lock); + if (!CRYPTO_THREAD_write_lock(obj_lock)) + return 0; if (name_funcs_stack == NULL) name_funcs_stack = sk_NAME_FUNCS_new_null(); @@ -169,7 +170,8 @@ const char *OBJ_NAME_get(const char *name, int type) return NULL; if (!OBJ_NAME_init()) return NULL; - CRYPTO_THREAD_read_lock(obj_lock); + if (!CRYPTO_THREAD_read_lock(obj_lock)) + return NULL; alias = type & OBJ_NAME_ALIAS; type &= ~OBJ_NAME_ALIAS; @@ -207,17 +209,18 @@ int OBJ_NAME_add(const char *name, int type, const char *data) type &= ~OBJ_NAME_ALIAS; onp = OPENSSL_malloc(sizeof(*onp)); - if (onp == NULL) { - /* ERROR */ - goto unlock; - } + if (onp == NULL) + return 0; onp->name = name; onp->alias = alias; onp->type = type; onp->data = data; - CRYPTO_THREAD_write_lock(obj_lock); + if (!CRYPTO_THREAD_write_lock(obj_lock)) { + OPENSSL_free(onp); + return 0; + } ret = lh_OBJ_NAME_insert(names_lh, onp); if (ret != NULL) { @@ -256,7 +259,8 @@ int OBJ_NAME_remove(const char *name, int type) if (!OBJ_NAME_init()) return 0; - CRYPTO_THREAD_write_lock(obj_lock); + if (!CRYPTO_THREAD_write_lock(obj_lock)) + return 0; type &= ~OBJ_NAME_ALIAS; on.name = name; |