mirror of https://gitee.com/openkylin/libvirt.git
test: Use g_autofree more
This commit doesn't aim to extinguish every VIR_FREE() call, but only those which were touched by the previous commit. The aim is to drop cleanup/error labels. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
This commit is contained in:
parent
b118215703
commit
74da85bcb9
|
@ -624,7 +624,7 @@ testQemuAgentCPU(const void *data)
|
|||
{
|
||||
virDomainXMLOption *xmlopt = (virDomainXMLOption *)data;
|
||||
g_autoptr(qemuMonitorTest) test = qemuMonitorTestNewAgent(xmlopt);
|
||||
qemuAgentCPUInfo *cpuinfo = NULL;
|
||||
g_autofree qemuAgentCPUInfo *cpuinfo = NULL;
|
||||
int nvcpus;
|
||||
int ret = -1;
|
||||
|
||||
|
@ -694,7 +694,6 @@ testQemuAgentCPU(const void *data)
|
|||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
VIR_FREE(cpuinfo);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -247,7 +247,7 @@ testQemuMonitorJSONGetVersion(const void *opaque)
|
|||
int major;
|
||||
int minor;
|
||||
int micro;
|
||||
char *package = NULL;
|
||||
g_autofree char *package = NULL;
|
||||
g_autoptr(qemuMonitorTest) test = NULL;
|
||||
|
||||
if (!(test = qemuMonitorTestNewSchema(xmlopt, data->schema)))
|
||||
|
@ -337,7 +337,6 @@ testQemuMonitorJSONGetVersion(const void *opaque)
|
|||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
VIR_FREE(package);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -997,8 +997,8 @@ qemuMonitorCommonTestNew(virDomainXMLOption *xmlopt,
|
|||
virDomainChrSourceDef *src)
|
||||
{
|
||||
g_autoptr(qemuMonitorTest) test = NULL;
|
||||
char *path = NULL;
|
||||
char *tmpdir_template = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
g_autofree char *tmpdir_template = NULL;
|
||||
|
||||
test = g_new0(qemuMonitorTest, 1);
|
||||
|
||||
|
@ -1047,8 +1047,6 @@ qemuMonitorCommonTestNew(virDomainXMLOption *xmlopt,
|
|||
return g_steal_pointer(&test);
|
||||
|
||||
error:
|
||||
VIR_FREE(path);
|
||||
VIR_FREE(tmpdir_template);
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue