[PATCH 18/23] qemumonitorjsontest: testBlockNodeNameDetect: Automatically free GHashTable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Additionally we no longer need the cleanup section.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 tests/qemumonitorjsontest.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index bcf5caa9a4..91a9193f2a 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -2490,24 +2490,23 @@ testBlockNodeNameDetect(const void *opaque)
     g_autofree char *actual = NULL;
     g_autoptr(virJSONValue) namedNodesJson = NULL;
     g_autoptr(virJSONValue) blockstatsJson = NULL;
-    GHashTable *nodedata = NULL;
+    g_autoptr(GHashTable) nodedata = NULL;
     g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
-    int ret = -1;

     resultFile = g_strdup_printf("%s/%s%s.result", abs_srcdir, pathprefix,
                                  testname);

     if (!(namedNodesJson = virTestLoadFileJSON(pathprefix, testname,
                                                "-named-nodes.json", NULL)))
-        goto cleanup;
+        return -1;

     if (!(blockstatsJson = virTestLoadFileJSON(pathprefix, testname,
                                                "-blockstats.json", NULL)))
-        goto cleanup;
+        return -1;

     if (!(nodedata = qemuBlockNodeNameGetBackingChain(namedNodesJson,
                                                       blockstatsJson)))
-        goto cleanup;
+        return -1;

     virHashForEachSorted(nodedata, testBlockNodeNameDetectFormat, &buf);

@@ -2516,14 +2515,9 @@ testBlockNodeNameDetect(const void *opaque)
     actual = virBufferContentAndReset(&buf);

     if (virTestCompareToFile(actual, resultFile) < 0)
-        goto cleanup;
-
-    ret = 0;
-
- cleanup:
-    virHashFree(nodedata);
+        return -1;

-    return ret;
+    return 0;
 }


-- 
2.31.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux