]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
hyperv: enable use of g_autoptr for hypervObject
authorMatt Coleman <mcoleman@datto.com>
Thu, 21 Jan 2021 18:50:45 +0000 (13:50 -0500)
committerLaine Stump <laine@redhat.com>
Fri, 22 Jan 2021 19:04:24 +0000 (14:04 -0500)
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
src/hyperv/hyperv_wmi.c
src/hyperv/hyperv_wmi.h

index 241993f2be5b5ce143bb5425b7d27e2c811f42bb..2a4377a12f5abb1d165636d56c12c111c56df39f 100644 (file)
@@ -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;
 }
index 11898f46e2384daf881d8b874317bd0eb2ad5f60..c9b2728df3ff77042f70e901544a19ed74ed7157 100644 (file)
@@ -64,6 +64,7 @@ int hypervEnumAndPull(hypervPrivate *priv, hypervWqlQueryPtr wqlQuery,
                       hypervObject **list);
 
 void hypervFreeObject(hypervObject *object);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(hypervObject, hypervFreeObject);
 
 
 /*