1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-04-01 20:05:19 +00:00

hyperv: use g_auto for WsXmlDocH in hypervDomainAttachCDROM

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:35 -05:00 committed by Laine Stump
parent 8d8a7e7db2
commit f29815668a

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