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/evp/evp_rand.c | |
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/evp/evp_rand.c')
-rw-r--r-- | crypto/evp/evp_rand.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/crypto/evp/evp_rand.c b/crypto/evp/evp_rand.c index e8dfd32ff7..03458a090f 100644 --- a/crypto/evp/evp_rand.c +++ b/crypto/evp/evp_rand.c @@ -78,7 +78,10 @@ static void *evp_rand_new(void) { EVP_RAND *rand = OPENSSL_zalloc(sizeof(*rand)); - if (rand == NULL || !CRYPTO_NEW_REF(&rand->refcnt, 1)) { + if (rand == NULL) + return NULL; + + if (!CRYPTO_NEW_REF(&rand->refcnt, 1)) { OPENSSL_free(rand); return NULL; } |