From 7e844cf618d67675928fb4c6fadc6cc16db19d19 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Wed, 18 Jan 2017 01:16:40 -0800 Subject: Fixes for valgrind issues. --- src/platform/posix/posix_rand.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/platform') diff --git a/src/platform/posix/posix_rand.c b/src/platform/posix/posix_rand.c index 76b2ee46..f8986e07 100644 --- a/src/platform/posix/posix_rand.c +++ b/src/platform/posix/posix_rand.c @@ -45,6 +45,8 @@ nni_plat_seed_prng(void *buf, size_t bufsz) struct nni_plat_prng_x x; int i; + memset(buf, 0, bufsz); + #if defined(NNG_USE_GETRANDOM) // Latest Linux has a nice API here. (void) getrandom(buf, bufsz, 0); @@ -72,6 +74,7 @@ nni_plat_seed_prng(void *buf, size_t bufsz) // limited of systems, we have at least *some* level of randomness. // The mixing is done in a way to avoid diminishing entropy we may // have already collected. + memset(&x, 0, sizeof (x)); // satisfy valgrind x.now = nni_clock(); x.pid = getpid(); x.uid = getuid(); -- cgit v1.2.3-70-g09d2