mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-23 13:05:27 +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;
|
virDomainPtr domain = NULL;
|
||||||
hypervPrivate *priv = conn->privateData;
|
hypervPrivate *priv = conn->privateData;
|
||||||
Msvm_ComputerSystem *computerSystem = NULL;
|
g_autoptr(Msvm_ComputerSystem) computerSystem = NULL;
|
||||||
|
|
||||||
if (hypervGetVirtualSystemByName(priv, name, &computerSystem) < 0)
|
if (hypervGetVirtualSystemByName(priv, name, &computerSystem) < 0)
|
||||||
goto cleanup;
|
return NULL;
|
||||||
|
|
||||||
if (computerSystem->next) {
|
if (computerSystem->next) {
|
||||||
virReportError(VIR_ERR_MULTIPLE_DOMAINS,
|
virReportError(VIR_ERR_MULTIPLE_DOMAINS,
|
||||||
_("Multiple domains exist with the name '%s': repeat the request using a UUID"),
|
_("Multiple domains exist with the name '%s': repeat the request using a UUID"),
|
||||||
name);
|
name);
|
||||||
goto cleanup;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
hypervMsvmComputerSystemToDomain(conn, computerSystem, &domain);
|
hypervMsvmComputerSystemToDomain(conn, computerSystem, &domain);
|
||||||
|
|
||||||
cleanup:
|
|
||||||
hypervFreeObject((hypervObject *)computerSystem);
|
|
||||||
|
|
||||||
return domain;
|
return domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user