1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-27 18:03:50 +03:00

libxl: Resolve possible NULL dereference

If we reached cleanup: prior to allocating cpus, it was possible that
'nr_nodes' had a value, but cpus was NULL leading to a possible NULL
deref. Add a 'cpus' as an end condition to for loop
This commit is contained in:
John Ferlan 2013-08-20 13:20:56 -04:00
parent 95577af442
commit 6aea4ebcd0

View File

@ -196,7 +196,7 @@ libxlCapsInitNuma(libxl_ctx *ctx, virCapsPtr caps)
cleanup:
if (ret != 0) {
for (i = 0; i < nr_nodes; i++)
for (i = 0; cpus && i < nr_nodes; i++)
VIR_FREE(cpus[i]);
virCapabilitiesFreeNUMAInfo(caps);
}