BUG/MINOR: log: Add OOM checks for calloc() and malloc() in logformat parser and...
authorAlexander Stephan <alexander.stephan@sap.com>
Mon, 1 Sep 2025 09:36:07 +0000 (09:36 +0000)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 1 Oct 2025 14:48:34 +0000 (16:48 +0200)
commit7964b6bcc657515ee63bfc7dd07f5432d3476d46
treed7884b363606781c7ce4993becc10d04175ed929
parent16dffef4dd64ab38a863c9c0b0013d9b377abb9e
BUG/MINOR: log: Add OOM checks for calloc() and malloc() in logformat parser and dup_logger()

This patch adds missing out-of-memory (OOM) checks after calls
to `calloc()` and `malloc()` in the logformat parser and the
`dup_logger()` function. If memory allocation fails, an error
is reported or NULL is returned, preventing undefined behavior
in low-memory conditions.

Co-authored-by: Christian Norbert Menges <christian.norbert.menges@sap.com>
(cherry picked from commit 22ac1f5ee9889eb7273201de0d92449d9fc5e3fa)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 0fd91432f06ee6a7b427664be127b02c854e34ab)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit de370ed1e1925fa54778ae021f92c97f96ca1a03)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
src/log.c