[PATCH 55/55] hyperv: use g_auto for WsXmlDocH in hypervDomainAttachCDROM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Matt Coleman <matt@xxxxxxxxx>
---
 src/hyperv/hyperv_driver.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
index b81cedf426..bdc084790a 100644
--- a/src/hyperv/hyperv_driver.c
+++ b/src/hyperv/hyperv_driver.c
@@ -722,8 +722,7 @@ hypervDomainAttachCDROM(virDomainPtr domain,
                         Msvm_ResourceAllocationSettingData *controller,
                         const char *hostname)
 {
-    int result = -1;
-    WsXmlDocH response = NULL;
+    g_auto(WsXmlDocH) response = NULL;
     g_autofree char *driveInstanceID = NULL;
 
     VIR_DEBUG("Now attaching CD/DVD '%s' with address %d to bus %d of type %d",
@@ -731,22 +730,16 @@ hypervDomainAttachCDROM(virDomainPtr domain,
               disk->info.addr.drive.controller, disk->bus);
 
     if (hypervDomainAddOpticalDrive(domain, disk, controller, hostname, &response) < 0)
-        goto cleanup;
+        return -1;
 
     driveInstanceID = hypervGetInstanceIDFromXMLResponse(response);
     if (!driveInstanceID)
-        goto cleanup;
+        return -1;
 
     if (hypervDomainAddOpticalDisk(domain, disk, hostname, driveInstanceID) < 0)
-        goto cleanup;
-
-    result = 0;
-
- cleanup:
-    if (response)
-        ws_xml_destroy_doc(response);
+        return -1;
 
-    return result;
+    return 0;
 }
 
 
-- 
2.30.0





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux