[PATCH 10/16] tests/virnetdaemontest.c: testExecRestart: Automatically free virJSONValue-s

Peter Krempa pkrempa at redhat.com
Fri Dec 3 14:57:37 UTC 2021


Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 tests/virnetdaemontest.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tests/virnetdaemontest.c b/tests/virnetdaemontest.c
index 70af1480df..24f4761bb7 100644
--- a/tests/virnetdaemontest.c
+++ b/tests/virnetdaemontest.c
@@ -273,8 +273,8 @@ static int testExecRestart(const void *opaque)
     g_autofree char *outfile = NULL;
     g_autofree char *injsonstr = NULL;
     g_autofree char *outjsonstr = NULL;
-    virJSONValue *injson = NULL;
-    virJSONValue *outjson = NULL;
+    g_autoptr(virJSONValue) injson = NULL;
+    g_autoptr(virJSONValue) outjson = NULL;
     int fdclient[2] = { -1, -1 }, fdserver[2] = { -1, -1 };

     if (socketpair(PF_UNIX, SOCK_STREAM, 0, fdclient) < 0) {
@@ -351,8 +351,6 @@ static int testExecRestart(const void *opaque)
             VIR_TEST_DEBUG("Test should have failed");
             ret = -1;
     }
-    virJSONValueFree(injson);
-    virJSONValueFree(outjson);
     virObjectUnref(dmn);
     VIR_FORCE_CLOSE(fdserver[0]);
     VIR_FORCE_CLOSE(fdserver[1]);
-- 
2.31.1




More information about the libvir-list mailing list