MINOR: cfgparse: few memory leaks fixes.

Some minor memory leak during the config parsing.
This commit is contained in:
David Carlier 2016-08-22 23:27:42 +01:00 committed by Willy Tarreau
parent 41d5e3a610
commit 70d604593d

View File

@ -1604,6 +1604,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
if (logsrv->format < 0) { if (logsrv->format < 0) {
Alert("parsing [%s:%d] : unknown log format '%s'\n", file, linenum, args[arg+3]); Alert("parsing [%s:%d] : unknown log format '%s'\n", file, linenum, args[arg+3]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
free(logsrv);
goto out; goto out;
} }
@ -6841,9 +6842,10 @@ cfg_parse_users(const char *file, int linenum, char **args, int kwm)
} }
ag->name = strdup(args[1]); ag->name = strdup(args[1]);
if (!ag) { if (!ag->name) {
Alert("parsing [%s:%d]: out of memory.\n", file, linenum); Alert("parsing [%s:%d]: out of memory.\n", file, linenum);
err_code |= ERR_ALERT | ERR_ABORT; err_code |= ERR_ALERT | ERR_ABORT;
free(ag);
goto out; goto out;
} }
@ -6858,6 +6860,9 @@ cfg_parse_users(const char *file, int linenum, char **args, int kwm)
Alert("parsing [%s:%d]: '%s' only supports 'users' option.\n", Alert("parsing [%s:%d]: '%s' only supports 'users' option.\n",
file, linenum, args[0]); file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
free(ag->groupusers);
free(ag->name);
free(ag);
goto out; goto out;
} }
} }