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@xxxxxxxxxx> --- tests/qemuagenttest.c | 3 +-- tests/qemumonitorjsontest.c | 3 +-- tests/qemumonitortestutils.c | 6 ++---- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/qemuagenttest.c b/tests/qemuagenttest.c index 402c290056..479f4c0503 100644 --- a/tests/qemuagenttest.c +++ b/tests/qemuagenttest.c @@ -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; } diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index e51d6768d5..e4bc656308 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -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; } diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index 2c63e95bda..2ca17f7f48 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -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; } -- 2.32.0