mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-21 19:02:25 +00:00
virsh-interface: Resolve Coverity issues
Recent changes uncovered FORWARD_NULL and NEGATIVE_RETURNS problems with the processing of the 'nActiveIfaces' and 'nInactiveIfaces' and their associated allocated arrays in 'vshInterfaceListCollect' due to the possibility of returning -1 in a call and using the return value as a for loop index end condition.
This commit is contained in:
parent
0cfd40ac0c
commit
50210ab9ff
@ -300,10 +300,10 @@ finished:
|
||||
success = true;
|
||||
|
||||
cleanup:
|
||||
for (i = 0; i < nActiveIfaces; i++)
|
||||
for (i = 0; nActiveIfaces != -1 && i < nActiveIfaces; i++)
|
||||
VIR_FREE(activeNames[i]);
|
||||
|
||||
for (i = 0; i < nInactiveIfaces; i++)
|
||||
for (i = 0; nInactiveIfaces != -1 && i < nInactiveIfaces; i++)
|
||||
VIR_FREE(inactiveNames[i]);
|
||||
|
||||
VIR_FREE(activeNames);
|
||||
|
Loading…
x
Reference in New Issue
Block a user