|
From e871cc2f15ad121e1e840191f59c6c86d6d0580d Mon Sep 17 00:00:00 2001
|
|
From: David Carlier <devnexen@gmail.com>
|
|
Date: Mon, 22 Aug 2016 23:27:42 +0100
|
|
Subject: [PATCH 22/26] MINOR: cfgparse: few memory leaks fixes.
|
|
|
|
Some minor memory leak during the config parsing.
|
|
(cherry picked from commit 70d604593d507f50fd99cebecee4b2c47c1d9b73)
|
|
---
|
|
src/cfgparse.c | 7 ++++++-
|
|
1 file changed, 6 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/cfgparse.c b/src/cfgparse.c
|
|
index f2a104d..b8289a2 100644
|
|
--- a/src/cfgparse.c
|
|
+++ b/src/cfgparse.c
|
|
@@ -1597,6 +1597,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
|
if (logsrv->format < 0) {
|
|
Alert("parsing [%s:%d] : unknown log format '%s'\n", file, linenum, args[arg+3]);
|
|
err_code |= ERR_ALERT | ERR_FATAL;
|
|
+ free(logsrv);
|
|
goto out;
|
|
}
|
|
|
|
@@ -6777,9 +6778,10 @@ cfg_parse_users(const char *file, int linenum, char **args, int kwm)
|
|
}
|
|
|
|
ag->name = strdup(args[1]);
|
|
- if (!ag) {
|
|
+ if (!ag->name) {
|
|
Alert("parsing [%s:%d]: out of memory.\n", file, linenum);
|
|
err_code |= ERR_ALERT | ERR_ABORT;
|
|
+ free(ag);
|
|
goto out;
|
|
}
|
|
|
|
@@ -6794,6 +6796,9 @@ cfg_parse_users(const char *file, int linenum, char **args, int kwm)
|
|
Alert("parsing [%s:%d]: '%s' only supports 'users' option.\n",
|
|
file, linenum, args[0]);
|
|
err_code |= ERR_ALERT | ERR_FATAL;
|
|
+ free(ag->groupusers);
|
|
+ free(ag->name);
|
|
+ free(ag);
|
|
goto out;
|
|
}
|
|
}
|
|
--
|
|
2.7.3
|
|
|