mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-23 04:55:18 +00:00
hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainLookupByName
Signed-off-by: Matt Coleman <matt@datto.com> Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
parent
38560b7efe
commit
ebca8a6b72
@ -1689,23 +1689,20 @@ hypervDomainLookupByName(virConnectPtr conn, const char *name)
|
||||
{
|
||||
virDomainPtr domain = NULL;
|
||||
hypervPrivate *priv = conn->privateData;
|
||||
Msvm_ComputerSystem *computerSystem = NULL;
|
||||
g_autoptr(Msvm_ComputerSystem) computerSystem = NULL;
|
||||
|
||||
if (hypervGetVirtualSystemByName(priv, name, &computerSystem) < 0)
|
||||
goto cleanup;
|
||||
return NULL;
|
||||
|
||||
if (computerSystem->next) {
|
||||
virReportError(VIR_ERR_MULTIPLE_DOMAINS,
|
||||
_("Multiple domains exist with the name '%s': repeat the request using a UUID"),
|
||||
name);
|
||||
goto cleanup;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
hypervMsvmComputerSystemToDomain(conn, computerSystem, &domain);
|
||||
|
||||
cleanup:
|
||||
hypervFreeObject((hypervObject *)computerSystem);
|
||||
|
||||
return domain;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user