Raise an Err when CRYPTO_THREAD_lock_new fails Add missing error raise call, as it is done everywhere else. and as CRYPTO_THREAD_lock_new don't do it internally. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
diff --git a/crypto/asn1/tasn_utl.c b/crypto/asn1/tasn_utl.c index cb24593..f03f9e9 100644 --- a/crypto/asn1/tasn_utl.c +++ b/crypto/asn1/tasn_utl.c
@@ -50,6 +50,7 @@ * then the count is incremented. If op is 0 count is set to 1. If op is -1 * count is decremented and the return value is the current reference count * or 0 if no reference count exists. + * FIXME: return and manage any error from inside this method */ int asn1_do_lock(ASN1_VALUE **pval, int op, const ASN1_ITEM *it) @@ -68,8 +69,10 @@ if (op == 0) { *lck = 1; *lock = CRYPTO_THREAD_lock_new(); - if (*lock == NULL) + if (*lock == NULL) { + /* FIXME: should report an error (-1) at this point */ return 0; + } return 1; } CRYPTO_atomic_add(lck, op, &ret, *lock);
diff --git a/crypto/dh/dh_lib.c b/crypto/dh/dh_lib.c index 8645b67..6a59f7f 100644 --- a/crypto/dh/dh_lib.c +++ b/crypto/dh/dh_lib.c
@@ -64,6 +64,7 @@ ret->references = 1; ret->lock = CRYPTO_THREAD_lock_new(); if (ret->lock == NULL) { + DHerr(DH_F_DH_NEW_METHOD, ERR_R_MALLOC_FAILURE); OPENSSL_free(ret); return NULL; }
diff --git a/crypto/dsa/dsa_lib.c b/crypto/dsa/dsa_lib.c index 9294594..14cb35f 100644 --- a/crypto/dsa/dsa_lib.c +++ b/crypto/dsa/dsa_lib.c
@@ -73,6 +73,7 @@ ret->references = 1; ret->lock = CRYPTO_THREAD_lock_new(); if (ret->lock == NULL) { + DSAerr(DSA_F_DSA_NEW_METHOD, ERR_R_MALLOC_FAILURE); OPENSSL_free(ret); return NULL; }
diff --git a/crypto/dso/dso_lib.c b/crypto/dso/dso_lib.c index 6bb9f5f..bea8776 100644 --- a/crypto/dso/dso_lib.c +++ b/crypto/dso/dso_lib.c
@@ -39,6 +39,7 @@ ret->references = 1; ret->lock = CRYPTO_THREAD_lock_new(); if (ret->lock == NULL) { + DSOerr(DSO_F_DSO_NEW_METHOD, ERR_R_MALLOC_FAILURE); sk_void_free(ret->meth_data); OPENSSL_free(ret); return NULL;