PR: 2786
[openssl.git] / crypto / rand / rand_lib.c
index 8c28550a7606b125dee5fec5d2236e578ccf89d0..e8957dbb306cc6dbc7d673f7fa0bcfa787559d1a 100644 (file)
@@ -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