mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
hellolibvirt: Resolve Coverity issues
Recent changes uncovered a NEGATIVE_RETURNS when processing 'numNames' in 'showDomains' in the for loop after a possible -1 return.
This commit is contained in:
parent
7961ad2107
commit
0776809659
@ -90,6 +90,13 @@ showDomains(virConnectPtr conn)
|
||||
numNames = virConnectListAllDomains(conn,
|
||||
&nameList,
|
||||
flags);
|
||||
if (numNames == -1) {
|
||||
ret = 1;
|
||||
printf("Failed to get a list of all domains: %s\n",
|
||||
virGetLastErrorMessage());
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (i = 0; i < numNames; i++) {
|
||||
int active = virDomainIsActive(nameList[i]);
|
||||
printf(" %8s (%s)\n",
|
||||
|
Loading…
Reference in New Issue
Block a user