mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-12 13:17:58 +03:00
hyperv: use g_autoptr for Win32_ComputerSystemProduct in hypervLookupHostSystemBiosUuid
Signed-off-by: Matt Coleman <matt@datto.com> Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
parent
08df82a72e
commit
e1e58cb122
@ -237,25 +237,20 @@ hypervParseVersionString(const char *str, unsigned int *major,
|
|||||||
static int
|
static int
|
||||||
hypervLookupHostSystemBiosUuid(hypervPrivate *priv, unsigned char *uuid)
|
hypervLookupHostSystemBiosUuid(hypervPrivate *priv, unsigned char *uuid)
|
||||||
{
|
{
|
||||||
Win32_ComputerSystemProduct *computerSystem = NULL;
|
g_autoptr(Win32_ComputerSystemProduct) computerSystem = NULL;
|
||||||
g_auto(virBuffer) query = { g_string_new(WIN32_COMPUTERSYSTEMPRODUCT_WQL_SELECT), 0 };
|
g_auto(virBuffer) query = { g_string_new(WIN32_COMPUTERSYSTEMPRODUCT_WQL_SELECT), 0 };
|
||||||
int result = -1;
|
|
||||||
|
|
||||||
if (hypervGetWmiClass(Win32_ComputerSystemProduct, &computerSystem) < 0)
|
if (hypervGetWmiClass(Win32_ComputerSystemProduct, &computerSystem) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (virUUIDParse(computerSystem->data->UUID, uuid) < 0) {
|
if (virUUIDParse(computerSystem->data->UUID, uuid) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Could not parse UUID from string '%s'"),
|
_("Could not parse UUID from string '%s'"),
|
||||||
computerSystem->data->UUID);
|
computerSystem->data->UUID);
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
result = 0;
|
|
||||||
|
|
||||||
cleanup:
|
return 0;
|
||||||
hypervFreeObject((hypervObject *)computerSystem);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user