From 55dacb2a84b1b860498b126bfeb1a86de908ba45 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Mon, 6 Feb 2023 08:19:47 +0100 Subject: [PATCH] removing possible memory leaks from why2_init_logger --- src/logger/lib/logger.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/logger/lib/logger.c b/src/logger/lib/logger.c index 48cc64c..f12dc9c 100644 --- a/src/logger/lib/logger.c +++ b/src/logger/lib/logger.c @@ -77,7 +77,7 @@ why2_log_file why2_init_logger(char *directoryPath) sprintf(filePath, WHY2_LOG_FORMATTING, directoryPath, dateBuffer, buffer); //GENERATE LOG-NAME - file = why2_open(filePath, O_RDWR | O_APPEND | O_CREAT, 0644); //CREATE LOG FILE + file = open(filePath, O_RDWR | O_APPEND | O_CREAT, 0644); //CREATE LOG FILE //CREATE SYMLINK sprintf(latestBuffer, WHY2_LOG_LATEST_FORMATTING, WHY2_WRITE_DIR, WHY2_LOG_LATEST); //GENERATE LATEST.log PATH @@ -90,6 +90,7 @@ why2_log_file why2_init_logger(char *directoryPath) { if (!why2_get_flags().no_output) fprintf(stderr, "Creating symlink failed!\n"); + close(file); why2_clean_memory("logger_logfile_init"); return why2_empty_log_file(); }