From a42e0a9ca9545a981978e3553a9601a183478cc7 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Sun, 5 Feb 2023 19:07:43 +0100 Subject: [PATCH] implemented why2_open wow no memory leak ngl didn't expect that --- src/logger/lib/logger.c | 2 +- src/logger/lib/utils.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/logger/lib/logger.c b/src/logger/lib/logger.c index a3b6ac2..48cc64c 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 = open(filePath, O_RDWR | O_APPEND | O_CREAT, 0644); //CREATE LOG FILE + file = why2_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 diff --git a/src/logger/lib/utils.c b/src/logger/lib/utils.c index a7bbb18..a088d02 100644 --- a/src/logger/lib/utils.c +++ b/src/logger/lib/utils.c @@ -31,7 +31,7 @@ along with this program. If not, see . void why2_deallocate_logger(why2_log_file logger) { - close(logger.file); + why2_deallocate(&logger.file); why2_deallocate(logger.filename); logger.filename = NULL;