Signed-off-by: Matt Coleman <matt(a)datto.com>
---
src/hyperv/hyperv_wmi.c | 3 +--
src/hyperv/hyperv_wmi.h | 1 +
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/hyperv/hyperv_wmi.c b/src/hyperv/hyperv_wmi.c
index 241993f2be..2a4377a12f 100644
--- a/src/hyperv/hyperv_wmi.c
+++ b/src/hyperv/hyperv_wmi.c
@@ -939,7 +939,7 @@ hypervEnumAndPull(hypervPrivate *priv, hypervWqlQueryPtr wqlQuery,
filter_t *filter = NULL;
WsXmlDocH response = NULL;
char *enumContext = NULL;
- hypervObject *head = NULL;
+ g_autoptr(hypervObject) head = NULL;
hypervObject *tail = NULL;
WsXmlNodeH node = NULL;
hypervObject *object;
@@ -1062,7 +1062,6 @@ hypervEnumAndPull(hypervPrivate *priv, hypervWqlQueryPtr wqlQuery,
VIR_FREE(query_string);
ws_xml_destroy_doc(response);
VIR_FREE(enumContext);
- hypervFreeObject(head);
return result;
}
diff --git a/src/hyperv/hyperv_wmi.h b/src/hyperv/hyperv_wmi.h
index 11898f46e2..c9b2728df3 100644
--- a/src/hyperv/hyperv_wmi.h
+++ b/src/hyperv/hyperv_wmi.h
@@ -64,6 +64,7 @@ int hypervEnumAndPull(hypervPrivate *priv, hypervWqlQueryPtr wqlQuery,
hypervObject **list);
void hypervFreeObject(hypervObject *object);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(hypervObject, hypervFreeObject);
/*
--
2.30.0