[PATCH 2/4] hyperv: Use g_auto() for virHashTable in hypervCreateEmbeddedParam
Michal Privoznik
mprivozn at redhat.com
Mon Oct 19 11:35:06 UTC 2020
This will allow us to drop 'error' label later.
Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
src/hyperv/hyperv_wmi.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/hyperv/hyperv_wmi.c b/src/hyperv/hyperv_wmi.c
index 742a46bc28..2faa2f396f 100644
--- a/src/hyperv/hyperv_wmi.c
+++ b/src/hyperv/hyperv_wmi.c
@@ -318,7 +318,7 @@ hypervCreateEmbeddedParam(hypervPrivate *priv, hypervWmiClassInfoListPtr info)
{
size_t i;
int count = 0;
- virHashTablePtr table = NULL;
+ g_autoptr(virHashTable) table = NULL;
XmlSerializerInfo *typeinfo = NULL;
XmlSerializerInfo *item = NULL;
hypervWmiClassInfoPtr classInfo = NULL;
@@ -344,10 +344,9 @@ hypervCreateEmbeddedParam(hypervPrivate *priv, hypervWmiClassInfoListPtr info)
goto error;
}
- return table;
+ return g_steal_pointer(&table);
error:
- virHashFree(table);
return NULL;
}
--
2.26.2
More information about the libvir-list
mailing list