]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
hyperv: use g_auto for WsXmlDocH in hypervDomainAttachVirtualDisk
authorMatt Coleman <mcoleman@datto.com>
Thu, 21 Jan 2021 18:51:34 +0000 (13:51 -0500)
committerLaine Stump <laine@redhat.com>
Fri, 22 Jan 2021 19:04:29 +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 2c0e9e0614f935d66dcd78f8034046be05e3ed44..b81cedf42612db8112ad56ac0cb0b2c14d34041e 100644 (file)
@@ -496,9 +496,8 @@ hypervDomainAttachVirtualDisk(virDomainPtr domain,
                               Msvm_ResourceAllocationSettingData *controller,
                               const char *hostname)
 {
-    int result = -1;
     g_autofree char *parentInstanceID = NULL;
-    WsXmlDocH response = NULL;
+    g_auto(WsXmlDocH) response = NULL;
 
     VIR_DEBUG("Now attaching disk image '%s' with address %d to bus %d of type %d",
               disk->src->path, disk->info.addr.drive.unit, disk->info.addr.drive.controller, disk->bus);
@@ -513,17 +512,12 @@ hypervDomainAttachVirtualDisk(virDomainPtr domain,
 
     parentInstanceID = hypervGetInstanceIDFromXMLResponse(response);
     if (!parentInstanceID)
-        goto cleanup;
+        return -1;
 
     if (hypervDomainAddVirtualHardDisk(domain, disk, hostname, parentInstanceID) < 0)
-        goto cleanup;
-
-    result = 0;
-
- cleanup:
-    ws_xml_destroy_doc(response);
+        return -1;
 
-    return result;
+    return 0;
 }