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

hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainLookupByID

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:50:54 -05:00 committed by Laine Stump
parent cd20f59c0b
commit 2ce05af9f2

View File

@ -1654,16 +1654,13 @@ hypervDomainLookupByID(virConnectPtr conn, int id)
{
virDomainPtr domain = NULL;
hypervPrivate *priv = conn->privateData;
Msvm_ComputerSystem *computerSystem = NULL;
g_autoptr(Msvm_ComputerSystem) computerSystem = NULL;
if (hypervGetVirtualSystemByID(priv, id, &computerSystem) < 0)
goto cleanup;
return NULL;
hypervMsvmComputerSystemToDomain(conn, computerSystem, &domain);
cleanup:
hypervFreeObject((hypervObject *)computerSystem);
return domain;
}