mirror of
https://github.com/openssl/openssl.git
synced 2024-12-15 06:01:37 +08:00
Fix leak of a RAND_POOL in error condition
Fixes Coverity 1636676 Reviewed-by: Neil Horman <nhorman@openssl.org> Reviewed-by: Paul Dale <ppzgs1@gmail.com> Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/26154)
This commit is contained in:
parent
a82c2bf5c9
commit
c5257fd8d0
@ -112,8 +112,10 @@ static int seed_src_generate(void *vseed, unsigned char *out, size_t outlen,
|
||||
entropy_available = ossl_pool_acquire_entropy(pool);
|
||||
|
||||
if (entropy_available > 0) {
|
||||
if (!ossl_rand_pool_adin_mix_in(pool, adin, adin_len))
|
||||
if (!ossl_rand_pool_adin_mix_in(pool, adin, adin_len)) {
|
||||
ossl_rand_pool_free(pool);
|
||||
return 0;
|
||||
}
|
||||
memcpy(out, ossl_rand_pool_buffer(pool), ossl_rand_pool_length(pool));
|
||||
}
|
||||
|
||||
|
@ -198,8 +198,10 @@ static int jitter_generate(void *vseed, unsigned char *out, size_t outlen,
|
||||
entropy_available = ossl_prov_acquire_entropy_from_jitter(s, pool);
|
||||
|
||||
if (entropy_available > 0) {
|
||||
if (!ossl_rand_pool_adin_mix_in(pool, adin, adin_len))
|
||||
if (!ossl_rand_pool_adin_mix_in(pool, adin, adin_len)) {
|
||||
ossl_rand_pool_free(pool);
|
||||
return 0;
|
||||
}
|
||||
memcpy(out, ossl_rand_pool_buffer(pool), ossl_rand_pool_length(pool));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user