]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests/virnetdaemontest.c: testExecRestart: Automatically free virJSONValue-s
authorPeter Krempa <pkrempa@redhat.com>
Wed, 1 Dec 2021 08:28:08 +0000 (09:28 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 7 Dec 2021 08:00:39 +0000 (09:00 +0100)
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tests/virnetdaemontest.c

index 70af1480df29620d6c64a8bceaf075dad91900a8..24f4761bb764bedd4a4cab1de4ecf979683ba202 100644 (file)
@@ -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]);