summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2018-03-17 17:42:05 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2018-03-17 17:42:05 +0100
commitd9e72dedd3fedab30ca5a3f0c9cf466bd9289ea7 (patch)
tree17deda94a89ec61c56afa4170dc054066969a15e
parentba8bf1b26ac99d852d19496e6b2b81604f2f0116 (diff)
Avoid a warning about file handle leak in log_open_default()
-rw-r--r--src/log.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/log.c b/src/log.c
index 5311c8d..84092cb 100644
--- a/src/log.c
+++ b/src/log.c
@@ -111,6 +111,7 @@ FILE *log_open_default(const char*default_filename, const int mode, int *errsv)
{
char*filename;
char *path;
+ FILE *handle;
path = getenv("HOME");
if(path == NULL)
return log_open(default_filename, mode, errsv);
@@ -118,9 +119,9 @@ FILE *log_open_default(const char*default_filename, const int mode, int *errsv)
strcpy(filename, path);
strcat(filename, "/");
strcat(filename, default_filename);
- log_open(filename, mode, errsv);
+ handle=log_open(filename, mode, errsv);
free(filename);
- return log_handle;
+ return handle;
}
#endif