From: Ilia Shipitsin Date: Mon, 23 Dec 2024 20:59:37 +0000 (+0100) Subject: BUG/MINOR: checks: handle a possible strdup() failure X-Git-Tag: v3.2-dev2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=495f1f9741151d37c4f5630dccd967f45e5df423;p=thirdparty%2Fhaproxy.git BUG/MINOR: checks: handle a possible strdup() failure This defect was found by the coccinelle script "unchecked-strdup.cocci". It can be backported to all supported branches. --- diff --git a/src/check.c b/src/check.c index 29a86b7dd3..dde1e72b09 100644 --- a/src/check.c +++ b/src/check.c @@ -1667,6 +1667,10 @@ static int start_checks() /* 0- init the dummy frontend used to create all checks sessions */ init_new_proxy(&checks_fe); checks_fe.id = strdup("CHECKS-FE"); + if (!checks_fe.id) { + ha_alert("Out of memory creating the checks frontend.\n"); + return ERR_ALERT | ERR_FATAL; + } checks_fe.cap = PR_CAP_FE | PR_CAP_BE; checks_fe.mode = PR_MODE_TCP; checks_fe.maxconn = 0;