]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
testQemuGetLatestCaps: Use automatic memory management
authorTim Wiederhake <twiederh@redhat.com>
Mon, 5 Jul 2021 14:22:08 +0000 (16:22 +0200)
committerTim Wiederhake <twiederh@redhat.com>
Mon, 19 Jul 2021 14:39:41 +0000 (16:39 +0200)
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
tests/testutilsqemu.c

index 72c0b1857b6bdc93ca174fb4b7927944732ac419..72b53096d9293e2a8a188c1f82e4c4bc8ab979ba 100644 (file)
@@ -585,7 +585,7 @@ testQemuGetLatestCaps(void)
         "s390x",
         "x86_64",
     };
-    GHashTable *capslatest = virHashNew(g_free);
+    g_autoptr(GHashTable) capslatest = virHashNew(g_free);
     size_t i;
 
     VIR_TEST_VERBOSE("");
@@ -601,10 +601,9 @@ testQemuGetLatestCaps(void)
 
     VIR_TEST_VERBOSE("");
 
-    return capslatest;
+    return g_steal_pointer(&capslatest);
 
  error:
-    virHashFree(capslatest);
     return NULL;
 }