[PATCH 34/55] hyperv: use g_autoptr for Msvm_VirtualSystemSettingData in hypervDomainGetAutostart

Matt Coleman mcoleman at datto.com
Thu Jan 21 18:51:14 UTC 2021


Signed-off-by: Matt Coleman <matt at datto.com>
---
 src/hyperv/hyperv_driver.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
index 535bd34733..c63599c09e 100644
--- a/src/hyperv/hyperv_driver.c
+++ b/src/hyperv/hyperv_driver.c
@@ -2572,23 +2572,18 @@ hypervDomainAttachDevice(virDomainPtr domain, const char *xml)
 static int
 hypervDomainGetAutostart(virDomainPtr domain, int *autostart)
 {
-    int result = -1;
     char uuid_string[VIR_UUID_STRING_BUFLEN];
     hypervPrivate *priv = domain->conn->privateData;
-    Msvm_VirtualSystemSettingData *vssd = NULL;
+    g_autoptr(Msvm_VirtualSystemSettingData) vssd = NULL;
 
     virUUIDFormat(domain->uuid, uuid_string);
 
     if (hypervGetMsvmVirtualSystemSettingDataFromUUID(priv, uuid_string, &vssd) < 0)
-        goto cleanup;
+        return -1;
 
     *autostart = vssd->data->AutomaticStartupAction == 4;
-    result = 0;
 
- cleanup:
-    hypervFreeObject((hypervObject *)vssd);
-
-    return result;
+    return 0;
 }
 
 
-- 
2.30.0





More information about the libvir-list mailing list