summaryrefslogtreecommitdiffstats
path: root/log.c
diff options
context:
space:
mode:
authornicm <nicm>2015-09-24 12:03:58 +0000
committernicm <nicm>2015-09-24 12:03:58 +0000
commit69ea6b9373c0cc992932499b89330c26e27d6510 (patch)
treee7d44f29676a63fc0e323821fd2a2370e4023bc4 /log.c
parentddb2d1221b3a824114e7c456251c4cf983b0b330 (diff)
Do not leak log file descriptor.
Diffstat (limited to 'log.c')
-rw-r--r--log.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/log.c b/log.c
index 8c2fdb07..711b9b8a 100644
--- a/log.c
+++ b/log.c
@@ -42,6 +42,9 @@ log_event_cb(unused int severity, const char *msg)
void
log_open(const char *path)
{
+ if (log_file != NULL)
+ fclose(log_file);
+
log_file = fopen(path, "w");
if (log_file == NULL)
return;