aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDag Robole <dag.robole@gmail.com>2017-07-15 21:34:52 +0200
committerDag Robole <dag.robole@gmail.com>2017-07-15 21:34:52 +0200
commita8ae0b252a2007568e77f5aca1c7fa3ec5941b72 (patch)
tree0f0739c76541ba6918f9e0fdb06ad774ce161aa2
parent10b22e3141a603ec891d2cfc7100c29c7409aabe (diff)
Fix resource leak
-rw-r--r--src/random.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/random.cpp b/src/random.cpp
index 67efc7d945..6c39d98c56 100644
--- a/src/random.cpp
+++ b/src/random.cpp
@@ -191,6 +191,7 @@ void GetDevURandom(unsigned char *ent32)
do {
ssize_t n = read(f, ent32 + have, NUM_OS_RANDOM_BYTES - have);
if (n <= 0 || n + have > NUM_OS_RANDOM_BYTES) {
+ close(f);
RandFailure();
}
have += n;