1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-25 01:34:11 +03:00

hyperv: use g_auto for WsXmlDocH in hypervDomainAttachVirtualDisk

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
Matt Coleman 2021-01-21 13:51:34 -05:00 committed by Laine Stump
parent cc7a4b0139
commit 8d8a7e7db2

View 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;
return -1;
result = 0;
cleanup:
ws_xml_destroy_doc(response);
return result;
return 0;
}