tests: Use g_autoptr(qemuMonitorTest)

Instead of calling qemuMonitorTestFree() explicitly, we can use
g_autoptr() and let it be called automagically.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
This commit is contained in:
Michal Privoznik
2021-11-01 09:51:01 +01:00
parent da71790bbd
commit b118215703
6 changed files with 41 additions and 65 deletions

View File

@@ -96,7 +96,7 @@ qemuMigParamsTestXML(const void *opaque)
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
g_autofree char *replyFile = NULL;
g_autofree char *xmlFile = NULL;
qemuMonitorTest *mon = NULL;
g_autoptr(qemuMonitorTest) mon = NULL;
g_autoptr(virJSONValue) params = NULL;
g_autoptr(qemuMigrationParams) migParams = NULL;
g_autofree char *actualXML = NULL;
@@ -128,7 +128,6 @@ qemuMigParamsTestXML(const void *opaque)
ret = 0;
cleanup:
qemuMonitorTestFree(mon);
return ret;
}
@@ -139,7 +138,7 @@ qemuMigParamsTestJSON(const void *opaque)
const qemuMigParamsData *data = opaque;
g_autofree char *replyFile = NULL;
g_autofree char *jsonFile = NULL;
qemuMonitorTest *mon = NULL;
g_autoptr(qemuMonitorTest) mon = NULL;
g_autoptr(virJSONValue) paramsIn = NULL;
g_autoptr(virJSONValue) paramsOut = NULL;
g_autoptr(qemuMigrationParams) migParams = NULL;
@@ -184,7 +183,6 @@ qemuMigParamsTestJSON(const void *opaque)
ret = 0;
cleanup:
qemuMonitorTestFree(mon);
return ret;
}