Fix resource leak

Cherry-picked from: a8ae0b252a2007568e77f5aca1c7fa3ec5941b72
This commit is contained in:
Dag Robole 2017-07-15 21:34:52 +02:00 committed by xanimo
parent 60bd389823
commit 90d1972d81
No known key found for this signature in database
GPG Key ID: 6E8F17C1B1BCDCBE

View File

@ -187,6 +187,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;