]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainGetState
authorMatt Coleman <mcoleman@datto.com>
Thu, 21 Jan 2021 18:51:08 +0000 (13:51 -0500)
committerLaine Stump <laine@redhat.com>
Fri, 22 Jan 2021 19:04:26 +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 9cf074b6a7d0bb80bfd05bb66c0861431a18c372..44be9fbd2fad5cb0777dbc1a5b8e67a1dda8e084 100644 (file)
@@ -1957,25 +1957,19 @@ static int
 hypervDomainGetState(virDomainPtr domain, int *state, int *reason,
                      unsigned int flags)
 {
-    int result = -1;
-    Msvm_ComputerSystem *computerSystem = NULL;
+    g_autoptr(Msvm_ComputerSystem) computerSystem = NULL;
 
     virCheckFlags(0, -1);
 
     if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
-        goto cleanup;
+        return -1;
 
     *state = hypervMsvmComputerSystemEnabledStateToDomainState(computerSystem);
 
     if (reason != NULL)
         *reason = 0;
 
-    result = 0;
-
- cleanup:
-    hypervFreeObject((hypervObject *)computerSystem);
-
-    return result;
+    return 0;
 }