From 25e56fb494232ce061de2590a8734a29b7169e3f Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Fri, 19 Aug 2022 10:30:16 +0200 Subject: [PATCH] less strdup()+free() Improvement of f8ff93234eb118de2e69d0c4667a6cbbe90e8f8c Signed-off-by: Steffen Jaeckel --- src/log.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/log.c b/src/log.c index b85f1005..df93dd15 100644 --- a/src/log.c +++ b/src/log.c @@ -180,13 +180,10 @@ log_init(log_level_t filter, char* log_file) user_provided_log = TRUE; } - gchar* lf = files_get_log_file(log_file); + mainlogfile = files_get_log_file(log_file); - logp = fopen(lf, "a"); - g_chmod(lf, S_IRUSR | S_IWUSR); - mainlogfile = g_strdup(lf); - - g_free(lf); + logp = fopen(mainlogfile, "a"); + g_chmod(mainlogfile, S_IRUSR | S_IWUSR); } const char*