diff options
author | Dr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> | 2018-04-08 12:09:10 +0200 |
---|---|---|
committer | Dr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> | 2018-04-10 10:33:17 +0200 |
commit | 63a65d16acca53622a08861cdde8fe0e79beb522 (patch) | |
tree | ac04db1f29576117208772cae10ee6667117e08c /crypto/rand | |
parent | 55bd917bc4213bc668f48b87d8c6feb9918fef8f (diff) |
DRBG: fix memory leak on error in rand_drbg_get_entropy()
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5918)
Diffstat (limited to 'crypto/rand')
-rw-r--r-- | crypto/rand/rand_lib.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/rand/rand_lib.c b/crypto/rand/rand_lib.c index 3589e75853..6e98e4ddf8 100644 --- a/crypto/rand/rand_lib.c +++ b/crypto/rand/rand_lib.c @@ -229,7 +229,7 @@ size_t rand_drbg_get_entropy(RAND_DRBG *drbg, */ RANDerr(RAND_F_RAND_DRBG_GET_ENTROPY, RAND_R_PREDICTION_RESISTANCE_NOT_SUPPORTED); - return 0; + goto err; } /* Get entropy by polling system entropy sources. */ @@ -241,6 +241,7 @@ size_t rand_drbg_get_entropy(RAND_DRBG *drbg, *pout = rand_pool_detach(pool); } + err: rand_pool_free(pool); return ret; } |