mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
nodeinfo: avoid uninitialized variable on error
Commit 8ba0a58
introduced a compiler warning that I hit during
a run of ./autobuild.sh:
../../src/nodeinfo.c: In function 'nodeCapsInitNUMA':
../../src/nodeinfo.c:1853:43: error: 'nsiblings' may be used uninitialized in this function [-Werror=maybe-uninitialized]
if (virCapabilitiesAddHostNUMACell(caps, n, memory,
^
Sure enough, nsiblings starts uninitialized, and is set by a call
to virNodeCapsGetSiblingInfo, but that function fails to assign
through the pointer if virNumaGetDistances fails.
* src/nodeinfo.c (nodeCapsInitNUMA): Initialize nsiblings.
Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
1c7eb95c84
commit
10c10f4380
@ -1803,7 +1803,7 @@ nodeCapsInitNUMA(virCapsPtr caps)
|
|||||||
virCapsHostNUMACellCPUPtr cpus = NULL;
|
virCapsHostNUMACellCPUPtr cpus = NULL;
|
||||||
virBitmapPtr cpumap = NULL;
|
virBitmapPtr cpumap = NULL;
|
||||||
virCapsHostNUMACellSiblingInfoPtr siblings = NULL;
|
virCapsHostNUMACellSiblingInfoPtr siblings = NULL;
|
||||||
int nsiblings;
|
int nsiblings = 0;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
int ncpus = 0;
|
int ncpus = 0;
|
||||||
int cpu;
|
int cpu;
|
||||||
|
Loading…
Reference in New Issue
Block a user