From 7185e242ffaa8cd1b672fe4726502a196fd779c2 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Tue, 30 May 2017 08:47:55 +0100 Subject: [PATCH] rc-logger.c: fix crash on fclose(NULL) (#137) Only close the log if we successfully opened it. Reported-by: Brian Evans Tested-by: Brian Evans Signed-off-by: Sergei Trofimovich --- src/rc/rc-logger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rc/rc-logger.c b/src/rc/rc-logger.c index b4bd0eae..062ce3d9 100644 --- a/src/rc/rc-logger.c +++ b/src/rc/rc-logger.c @@ -261,12 +261,12 @@ rc_logger_open(const char *level) break; } } + fclose(log); } else { log_error = 1; eerror("Error: fopen(%s) failed: %s", TMPLOG, strerror(errno)); } - fclose(log); fclose(plog); } else { /*