diff options
author | Pauli <pauli@openssl.org> | 2023-07-02 17:19:17 +1000 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2023-07-05 08:34:00 +1000 |
commit | 97beb77f319f119957235233396627bb22283da0 (patch) | |
tree | e2c58f0b0e46f90ca732da86e9a315a781622ed9 /crypto/dsa | |
parent | 52c362b3fe5ab9b1c44ec560820b242eb3df0e3b (diff) |
fix memory allocation and reference counting issues
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/21341)
Diffstat (limited to 'crypto/dsa')
-rw-r--r-- | crypto/dsa/dsa_lib.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crypto/dsa/dsa_lib.c b/crypto/dsa/dsa_lib.c index 03c4cb0c06..c2ae3bf158 100644 --- a/crypto/dsa/dsa_lib.c +++ b/crypto/dsa/dsa_lib.c @@ -144,8 +144,11 @@ static DSA *dsa_new_intern(ENGINE *engine, OSSL_LIB_CTX *libctx) return NULL; } - if (!CRYPTO_NEW_REF(&ret->references, 1)) - goto err; + if (!CRYPTO_NEW_REF(&ret->references, 1)) { + CRYPTO_THREAD_lock_free(ret->lock); + OPENSSL_free(ret); + return NULL; + } ret->libctx = libctx; ret->meth = DSA_get_default_method(); |