diff --git a/tests/qemuagenttest.c b/tests/qemuagenttest.c index 28a543ce05..a659feedfb 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 fab413d05e..69c41ad42d 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; }