From: Willy Tarreau Date: Sat, 12 Apr 2025 16:22:34 +0000 (+0200) Subject: BUG/MINOR: cpu-topo: check the correct variable for NULL after malloc() X-Git-Tag: v3.2-dev11~78 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4a44d592ae102162f5d989630860001357de750a;p=thirdparty%2Fhaproxy.git BUG/MINOR: cpu-topo: check the correct variable for NULL after malloc() We were testing ha_cpu_topo instead of ha_cpu_clusters after an allocation, making the check ineffective. No backport is needed. --- diff --git a/src/cpu_topo.c b/src/cpu_topo.c index 0416d69db..2e64f21ea 100644 --- a/src/cpu_topo.c +++ b/src/cpu_topo.c @@ -1822,7 +1822,7 @@ static int cpu_topo_alloc(void) /* allocate the structures used to store CPU topology info */ ha_cpu_clusters = (struct ha_cpu_cluster*)malloc(cpu_topo_maxcpus * sizeof(*ha_cpu_clusters)); - if (!ha_cpu_topo) + if (!ha_cpu_clusters) return 0; /* preset all fields to -1 except the index and the state flags which