]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: cpu-topo: check the correct variable for NULL after malloc()
authorWilly Tarreau <w@1wt.eu>
Sat, 12 Apr 2025 16:22:34 +0000 (18:22 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 12 Apr 2025 16:23:29 +0000 (18:23 +0200)
We were testing ha_cpu_topo instead of ha_cpu_clusters after an allocation,
making the check ineffective.

No backport is needed.

src/cpu_topo.c

index 0416d69db007bdbec4444c01d6f5b307479a9aca..2e64f21ea96188cdf2121e7792202dd9b71e3f74 100644 (file)
@@ -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