diff options
author | Aurelien DARRAGON <adarragon@haproxy.com> | 2023-05-11 18:57:23 +0200 |
---|---|---|
committer | Christopher Faulet <cfaulet@haproxy.com> | 2023-05-12 09:45:30 +0200 |
commit | 256d581fbdec0f2814835b5e5cf2825f226afc0e (patch) | |
tree | 275be007946bcb0fa6bebc8a867a8600e210f870 | |
parent | d4dba38ab101eee4cbd0c8d8aa21181825ef6472 (diff) | |
download | haproxy-256d581fbdec0f2814835b5e5cf2825f226afc0e.tar.gz |
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.
-rw-r--r-- | src/log.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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); |