removing possible memory leaks from why2_init_logger

This commit is contained in:
Václav Šmejkal 2023-02-06 08:19:47 +01:00
parent 109ec9a7b6
commit 55dacb2a84
Signed by: ENGO150
GPG Key ID: F6D6DF86242C5A59

View File

@ -77,7 +77,7 @@ why2_log_file why2_init_logger(char *directoryPath)
sprintf(filePath, WHY2_LOG_FORMATTING, directoryPath, dateBuffer, buffer); //GENERATE LOG-NAME 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 //CREATE SYMLINK
sprintf(latestBuffer, WHY2_LOG_LATEST_FORMATTING, WHY2_WRITE_DIR, WHY2_LOG_LATEST); //GENERATE LATEST.log PATH 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"); if (!why2_get_flags().no_output) fprintf(stderr, "Creating symlink failed!\n");
close(file);
why2_clean_memory("logger_logfile_init"); why2_clean_memory("logger_logfile_init");
return why2_empty_log_file(); return why2_empty_log_file();
} }