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>
This commit is contained in:
Ján Tomko 2020-07-28 02:59:58 +02:00
parent a7d3d925a7
commit aeb5951aa4
2 changed files with 5 additions and 10 deletions

View 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;
}

View 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;
}