]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainIsActive
authorMatt Coleman <mcoleman@datto.com>
Thu, 21 Jan 2021 18:51:17 +0000 (13:51 -0500)
committerLaine Stump <laine@redhat.com>
Fri, 22 Jan 2021 19:04:27 +0000 (14:04 -0500)
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
src/hyperv/hyperv_driver.c

index 6fa32d175df5d4fb64e638f520f12575325e0cf6..e501a88889babfa3012ab9aaf2bc00e08d0c4721 100644 (file)
@@ -2770,18 +2770,12 @@ hypervConnectIsAlive(virConnectPtr conn)
 static int
 hypervDomainIsActive(virDomainPtr domain)
 {
-    int result = -1;
-    Msvm_ComputerSystem *computerSystem = NULL;
+    g_autoptr(Msvm_ComputerSystem) computerSystem = NULL;
 
     if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
-        goto cleanup;
-
-    result = hypervIsMsvmComputerSystemActive(computerSystem, NULL) ? 1 : 0;
-
- cleanup:
-    hypervFreeObject((hypervObject *)computerSystem);
+        return -1;
 
-    return result;
+    return hypervIsMsvmComputerSystemActive(computerSystem, NULL) ? 1 : 0;
 }