]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainResume
authorMatt Coleman <mcoleman@datto.com>
Thu, 21 Jan 2021 18:50:57 +0000 (13:50 -0500)
committerLaine Stump <laine@redhat.com>
Fri, 22 Jan 2021 19:04:25 +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 dd5c42c45b0e67969215b8aecd97514820a0a6bc..1eb3dbd48ef0be7ac811315daa9ebc746a6f44c8 100644 (file)
@@ -1717,8 +1717,7 @@ hypervDomainSuspend(virDomainPtr domain)
 static int
 hypervDomainResume(virDomainPtr domain)
 {
-    int result = -1;
-    Msvm_ComputerSystem *computerSystem = NULL;
+    g_autoptr(Msvm_ComputerSystem) computerSystem = NULL;
 
     if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
         return -1;
@@ -1726,16 +1725,11 @@ hypervDomainResume(virDomainPtr domain)
     if (computerSystem->data->EnabledState != MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_QUIESCE) {
         virReportError(VIR_ERR_OPERATION_INVALID, "%s",
                        _("Domain is not paused"));
-        goto cleanup;
+        return -1;
     }
 
-    result = hypervInvokeMsvmComputerSystemRequestStateChange(domain,
-                                                              MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_ENABLED);
-
- cleanup:
-    hypervFreeObject((hypervObject *)computerSystem);
-
-    return result;
+    return hypervInvokeMsvmComputerSystemRequestStateChange(domain,
+                                                            MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_ENABLED);
 }