From: William Lallemand Date: Mon, 30 Nov 2026 10:57:48 +0000 (+0000) Subject: BUG/MINOR: deviceatlas: fix free() of an uninitialized cnew in checkinst X-Git-Url: https://git.kaiwu.me/http/%22../$%7BISSUES%7D/static/%7B@url%7D?a=commitdiff_plain;h=52315d551cf03d67b87565237b65ec57ded26b04;p=haproxy.git BUG/MINOR: deviceatlas: fix free() of an uninitialized cnew in checkinst Reported by GitHub user brhenc in issue #3597 (a follow-up of the Coverity report in #2428). In da_haproxy_checkinst(), "cnew" is filled by da_atlas_compile(), which does not guarantee to write anything back to the caller-supplied pointer when the compilation fails. The free() on the error path could then be called on an indeterminate stack value and crash the process. The fix introduced by d8ff676592 ("fix resource leak on hot-reload compile failure") is preserved since free(NULL) is a no-op if the library leaves the output untouched. This must be backported to 3.4, 3.3, 3.2, 3.1 and 3.0, which all received d8ff676592. --- diff --git a/addons/deviceatlas/da.c b/addons/deviceatlas/da.c index ab6d953a3..ac754e008 100644 --- a/addons/deviceatlas/da.c +++ b/addons/deviceatlas/da.c @@ -288,7 +288,7 @@ static void da_haproxy_checkinst(void) if (base[0] != 0 && base[0] != '0') { FILE *jsonp; - void *cnew, *cold; + void *cnew = NULL, *cold; da_status_t status; size_t atlassz; char atlasp[ATLASTOKSZ] = {0};