Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
static int
hypervConnectNumOfDefinedDomains(virConnectPtr conn)
{
- bool success = false;
hypervPrivate *priv = conn->privateData;
- Msvm_ComputerSystem *computerSystemList = NULL;
+ g_autoptr(Msvm_ComputerSystem) computerSystemList = NULL;
Msvm_ComputerSystem *computerSystem = NULL;
int count = 0;
if (hypervGetInactiveVirtualSystemList(priv, &computerSystemList) < 0)
- goto cleanup;
+ return -1;
for (computerSystem = computerSystemList; computerSystem != NULL;
computerSystem = computerSystem->next) {
++count;
}
- success = true;
-
- cleanup:
- hypervFreeObject((hypervObject *)computerSystemList);
-
- return success ? count : -1;
+ return count;
}