mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
hyperv: use g_autoptr for Win32_ComputerSystem in hypervConnectGetHostname
Signed-off-by: Matt Coleman <matt@datto.com> Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
parent
1c603b7c02
commit
067168bf69
@ -1493,19 +1493,12 @@ hypervConnectGetVersion(virConnectPtr conn, unsigned long *version)
|
||||
static char *
|
||||
hypervConnectGetHostname(virConnectPtr conn)
|
||||
{
|
||||
char *hostname = NULL;
|
||||
hypervPrivate *priv = conn->privateData;
|
||||
Win32_ComputerSystem *computerSystem = NULL;
|
||||
g_autoptr(Win32_ComputerSystem) computerSystem = NULL;
|
||||
|
||||
if (hypervGetPhysicalSystemList(priv, &computerSystem) < 0)
|
||||
goto cleanup;
|
||||
if (hypervGetPhysicalSystemList((hypervPrivate *)conn->privateData, &computerSystem) < 0)
|
||||
return NULL;
|
||||
|
||||
hostname = g_strdup(computerSystem->data->DNSHostName);
|
||||
|
||||
cleanup:
|
||||
hypervFreeObject((hypervObject *)computerSystem);
|
||||
|
||||
return hostname;
|
||||
return g_strdup(computerSystem->data->DNSHostName);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user