From: Dr. Stephen Henson Date: Wed, 22 Aug 2012 22:42:04 +0000 (+0000) Subject: PR: 2786 X-Git-Tag: OpenSSL_1_0_1d~72 X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff_plain;h=7a217076d902d1717d1ab9b851c6c5ad6d7a444c PR: 2786 Reported by: Tomas Mraz Treat a NULL value passed to drbg_free_entropy callback as non-op. This can happen if the call to fips_get_entropy fails. --- diff --git a/crypto/rand/rand_lib.c b/crypto/rand/rand_lib.c index daf1dab973..476a0cd187 100644 --- a/crypto/rand/rand_lib.c +++ b/crypto/rand/rand_lib.c @@ -210,8 +210,11 @@ static size_t drbg_get_entropy(DRBG_CTX *ctx, unsigned char **pout, static void drbg_free_entropy(DRBG_CTX *ctx, unsigned char *out, size_t olen) { - OPENSSL_cleanse(out, olen); - OPENSSL_free(out); + if (out) + { + OPENSSL_cleanse(out, olen); + OPENSSL_free(out); + } } /* Set "additional input" when generating random data. This uses the