diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-01-18 01:16:40 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-01-18 01:16:40 -0800 |
| commit | 7e844cf618d67675928fb4c6fadc6cc16db19d19 (patch) | |
| tree | cbb6b64780e01f14722887a72f6f727530fc4ef9 /src/platform | |
| parent | 37582a286039f44cc7d8d3b0790e83c03a1ee5bc (diff) | |
| download | nng-7e844cf618d67675928fb4c6fadc6cc16db19d19.tar.gz nng-7e844cf618d67675928fb4c6fadc6cc16db19d19.tar.bz2 nng-7e844cf618d67675928fb4c6fadc6cc16db19d19.zip | |
Fixes for valgrind issues.
Diffstat (limited to 'src/platform')
| -rw-r--r-- | src/platform/posix/posix_rand.c | 3 |
1 files changed, 3 insertions, 0 deletions
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(); |
