mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-07 05:51:48 +00:00
BUG/MINOR: log: fix memory error handling in parse_logsrv()
A check was missing in parse_logsrv() to make sure that malloc-dependent variable is checked for non-NULL before using it. If malloc fails, the function raises an error and stops, like it's already done at a few other places within the function. This partially fixes GH #2130. It should be backported to every stable versions.
This commit is contained in:
parent
d4dba38ab1
commit
256d581fbd
@ -809,6 +809,10 @@ int parse_logsrv(char **args, struct list *logsrvs, int do_del, const char *file
|
||||
}
|
||||
|
||||
node = malloc(sizeof(*node));
|
||||
if (!node) {
|
||||
memprintf(err, "out of memory error");
|
||||
goto error;
|
||||
}
|
||||
memcpy(node, logsrv, sizeof(struct logsrv));
|
||||
node->ref = logsrv;
|
||||
LIST_INIT(&node->list);
|
||||
|
Loading…
Reference in New Issue
Block a user