commit 62e281996f23c79e0f657a648c2474a81ff361db parent 60e64e067e203a71c49f3430a21cfbea13aa01fe Author: Michael Savage <mikejsavage@gmail.com> Date: Mon, 5 May 2014 20:08:56 +0100 Don't leak fds episode 2 Diffstat:
src/main.c | | | 5 | +++++ |
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/main.c b/src/main.c @@ -66,6 +66,11 @@ static int open_random( const char * const path ) { return BC_ERR_RNG; } + if( random_file != NULL ) { + // we never write anything so this should be ok... + ( void ) fclose( random_file ); + } + random_file = f; return 0;