mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
virsh-nodedev: Resolve Coverity issues
Recent changes uncovered FORWARD_NULL and NEGATIVE_RETURNS problems with the processing of the 'ndevices' and its associated allocated arrays in 'vshNodeDeviceListCollect' due to the possibility of returning -1 in a call and using the returned value as a for loop index end condition.
This commit is contained in:
parent
50210ab9ff
commit
f926804a91
@ -352,7 +352,7 @@ finished:
|
||||
success = true;
|
||||
|
||||
cleanup:
|
||||
for (i = 0; i < ndevices; i++)
|
||||
for (i = 0; ndevices != -1 && i < ndevices; i++)
|
||||
VIR_FREE(names[i]);
|
||||
VIR_FREE(names);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user