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.
(cherry picked from commit 256d581fbdec0f2814835b5e5cf2825f226afc0e)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit bf479ff2ff66e8643220d1852fd6b3292ea97c3c)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit 886b61528a013ae17373c85c85a67661086bf592)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/log.c b/src/log.c
index dccdb35..20b2c1e 100644
--- a/src/log.c
+++ b/src/log.c
@@ -856,6 +856,10 @@
}
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);