Fix resource leak

This commit is contained in:
Dag Robole 2017-07-15 21:34:52 +02:00
parent 10b22e3141
commit a8ae0b252a

View file

@ -191,6 +191,7 @@ void GetDevURandom(unsigned char *ent32)
do { do {
ssize_t n = read(f, ent32 + have, NUM_OS_RANDOM_BYTES - have); ssize_t n = read(f, ent32 + have, NUM_OS_RANDOM_BYTES - have);
if (n <= 0 || n + have > NUM_OS_RANDOM_BYTES) { if (n <= 0 || n + have > NUM_OS_RANDOM_BYTES) {
close(f);
RandFailure(); RandFailure();
} }
have += n; have += n;