]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tests: bhyve: use g_autoptr where possible
authorJán Tomko <jtomko@redhat.com>
Tue, 28 Jul 2020 00:59:58 +0000 (02:59 +0200)
committerJán Tomko <jtomko@redhat.com>
Mon, 3 Aug 2020 05:23:46 +0000 (07:23 +0200)
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
Reviewed-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
tests/bhyveargv2xmltest.c
tests/bhyvexml2argvtest.c

index e58a36d17c73647fba768d13f23fb7f84a1f14f8..e7ec3ae020a36dcb9f3851b4fc171c71220c59f2 100644 (file)
@@ -32,7 +32,7 @@ testCompareXMLToArgvFiles(const char *xmlfile,
     g_autofree char *cmd = NULL;
     g_autofree char *log = NULL;
     int ret = -1;
-    virDomainDefPtr vmdef = NULL;
+    g_autoptr(virDomainDef) vmdef = NULL;
 
     if (virTestLoadFile(cmdfile, &cmd) < 0)
         goto fail;
@@ -86,7 +86,6 @@ testCompareXMLToArgvFiles(const char *xmlfile,
     ret = 0;
 
  fail:
-    virDomainDefFree(vmdef);
     return ret;
 }
 
index ce2af08d4ccc67bf5c33431f4474369f2fff6910..33e7ac5772d893a15c451c1cf72d704cc2212ff2 100644 (file)
@@ -29,10 +29,10 @@ static int testCompareXMLToArgvFiles(const char *xml,
     g_autofree char *actualargv = NULL;
     g_autofree char *actualld = NULL;
     g_autofree char *actualdm = NULL;
-    virDomainDefPtr vmdef = NULL;
-    virCommandPtr cmd = NULL;
-    virCommandPtr ldcmd = NULL;
-    virConnectPtr conn;
+    g_autoptr(virDomainDef) vmdef = NULL;
+    g_autoptr(virCommand) cmd = NULL;
+    g_autoptr(virCommand) ldcmd = NULL;
+    g_autoptr(virConnect) conn = NULL;
     int ret = -1;
 
     if (!(conn = virGetConnect()))
@@ -99,10 +99,6 @@ static int testCompareXMLToArgvFiles(const char *xml,
         vmdef->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC)
         virPortAllocatorRelease(vmdef->graphics[0]->data.vnc.port);
 
-    virCommandFree(cmd);
-    virCommandFree(ldcmd);
-    virDomainDefFree(vmdef);
-    virObjectUnref(conn);
     return ret;
 }