mirror of
https://github.com/haproxy/haproxy.git
synced 2026-02-20 00:10:41 -05:00
BUG/MINOR: Fix memory leaks cfg_parse_peers
When memory allocation fails in cfg_parse_peers or when an error occurs while parsing a stick-table, the temporary table and its id must be freed. This fixes github issue #854. It should be backported as far as 2.0.
This commit is contained in:
parent
d2414a23c4
commit
1aab911017
1 changed files with 6 additions and 1 deletions
|
|
@ -884,13 +884,18 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm)
|
|||
if (!t || !id) {
|
||||
ha_alert("parsing [%s:%d]: '%s %s' : memory allocation failed\n",
|
||||
file, linenum, args[0], args[1]);
|
||||
free(t);
|
||||
free(id);
|
||||
err_code |= ERR_ALERT | ERR_FATAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
err_code |= parse_stick_table(file, linenum, args, t, id, id + prefix_len, curpeers);
|
||||
if (err_code & ERR_FATAL)
|
||||
if (err_code & ERR_FATAL) {
|
||||
free(t);
|
||||
free(id);
|
||||
goto out;
|
||||
}
|
||||
|
||||
stktable_store_name(t);
|
||||
t->next = stktables_list;
|
||||
|
|
|
|||
Loading…
Reference in a new issue