mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
tests: bhyve: use g_autofree 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:
parent
7b4a8995a0
commit
a7d3d925a7
@ -28,9 +28,9 @@ testCompareXMLToArgvFiles(const char *xmlfile,
|
||||
unsigned int flags)
|
||||
|
||||
{
|
||||
char *actualxml = NULL;
|
||||
char *cmd = NULL;
|
||||
char *log = NULL;
|
||||
g_autofree char *actualxml = NULL;
|
||||
g_autofree char *cmd = NULL;
|
||||
g_autofree char *log = NULL;
|
||||
int ret = -1;
|
||||
virDomainDefPtr vmdef = NULL;
|
||||
|
||||
@ -86,9 +86,6 @@ testCompareXMLToArgvFiles(const char *xmlfile,
|
||||
ret = 0;
|
||||
|
||||
fail:
|
||||
VIR_FREE(actualxml);
|
||||
VIR_FREE(cmd);
|
||||
VIR_FREE(log);
|
||||
virDomainDefFree(vmdef);
|
||||
return ret;
|
||||
}
|
||||
@ -103,8 +100,8 @@ testCompareXMLToArgvHelper(const void *data)
|
||||
{
|
||||
int result = -1;
|
||||
const struct testInfo *info = data;
|
||||
char *xml = NULL;
|
||||
char *args = NULL;
|
||||
g_autofree char *xml = NULL;
|
||||
g_autofree char *args = NULL;
|
||||
|
||||
xml = g_strdup_printf("%s/bhyveargv2xmldata/bhyveargv2xml-%s.xml",
|
||||
abs_srcdir, info->name);
|
||||
@ -112,9 +109,6 @@ testCompareXMLToArgvHelper(const void *data)
|
||||
abs_srcdir, info->name);
|
||||
|
||||
result = testCompareXMLToArgvFiles(xml, args, info->flags);
|
||||
|
||||
VIR_FREE(xml);
|
||||
VIR_FREE(args);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -26,9 +26,9 @@ static int testCompareXMLToArgvFiles(const char *xml,
|
||||
const char *dmcmdline,
|
||||
unsigned int flags)
|
||||
{
|
||||
char *actualargv = NULL;
|
||||
char *actualld = NULL;
|
||||
char *actualdm = NULL;
|
||||
g_autofree char *actualargv = NULL;
|
||||
g_autofree char *actualld = NULL;
|
||||
g_autofree char *actualdm = NULL;
|
||||
virDomainDefPtr vmdef = NULL;
|
||||
virCommandPtr cmd = NULL;
|
||||
virCommandPtr ldcmd = NULL;
|
||||
@ -99,9 +99,6 @@ static int testCompareXMLToArgvFiles(const char *xml,
|
||||
vmdef->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC)
|
||||
virPortAllocatorRelease(vmdef->graphics[0]->data.vnc.port);
|
||||
|
||||
VIR_FREE(actualargv);
|
||||
VIR_FREE(actualld);
|
||||
VIR_FREE(actualdm);
|
||||
virCommandFree(cmd);
|
||||
virCommandFree(ldcmd);
|
||||
virDomainDefFree(vmdef);
|
||||
@ -119,10 +116,10 @@ testCompareXMLToArgvHelper(const void *data)
|
||||
{
|
||||
int ret = -1;
|
||||
const struct testInfo *info = data;
|
||||
char *xml = NULL;
|
||||
char *args = NULL;
|
||||
char *ldargs = NULL;
|
||||
char *dmargs = NULL;
|
||||
g_autofree char *xml = NULL;
|
||||
g_autofree char *args = NULL;
|
||||
g_autofree char *ldargs = NULL;
|
||||
g_autofree char *dmargs = NULL;
|
||||
|
||||
xml = g_strdup_printf("%s/bhyvexml2argvdata/bhyvexml2argv-%s.xml",
|
||||
abs_srcdir, info->name);
|
||||
@ -135,10 +132,6 @@ testCompareXMLToArgvHelper(const void *data)
|
||||
|
||||
ret = testCompareXMLToArgvFiles(xml, args, ldargs, dmargs, info->flags);
|
||||
|
||||
VIR_FREE(xml);
|
||||
VIR_FREE(args);
|
||||
VIR_FREE(ldargs);
|
||||
VIR_FREE(dmargs);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -26,8 +26,8 @@ static int
|
||||
testCompareXMLToXMLHelper(const void *data)
|
||||
{
|
||||
const struct testInfo *info = data;
|
||||
char *xml_in = NULL;
|
||||
char *xml_out = NULL;
|
||||
g_autofree char *xml_in = NULL;
|
||||
g_autofree char *xml_out = NULL;
|
||||
bool is_different = info->flags & FLAG_IS_DIFFERENT;
|
||||
int ret = -1;
|
||||
|
||||
@ -48,8 +48,6 @@ testCompareXMLToXMLHelper(const void *data)
|
||||
virResetLastError();
|
||||
}
|
||||
|
||||
VIR_FREE(xml_in);
|
||||
VIR_FREE(xml_out);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user