summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJán Tomko <jtomko@redhat.com>2020-07-28 02:59:58 +0200
committerJán Tomko <jtomko@redhat.com>2020-08-03 07:23:46 +0200
commitaeb5951aa458725a5461e35775ac9cdb9d6ffe0b (patch)
treed28091408fda5052a24d7bac66bd63fdfac03db8
parenta7d3d925a7eae5b61c9cd6205aecd16b3765ec9c (diff)
downloadlibvirt-aeb5951aa458725a5461e35775ac9cdb9d6ffe0b.tar.gz
tests: bhyve: use g_autoptr where possible
Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Laine Stump <laine@redhat.com> Reviewed-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
-rw-r--r--tests/bhyveargv2xmltest.c3
-rw-r--r--tests/bhyvexml2argvtest.c12
2 files changed, 5 insertions, 10 deletions
diff --git a/tests/bhyveargv2xmltest.c b/tests/bhyveargv2xmltest.c
index e58a36d17c..e7ec3ae020 100644
--- a/tests/bhyveargv2xmltest.c
+++ b/tests/bhyveargv2xmltest.c
@@ -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;
}
diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c
index ce2af08d4c..33e7ac5772 100644
--- a/tests/bhyvexml2argvtest.c
+++ b/tests/bhyvexml2argvtest.c
@@ -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;
}