Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
tests/cputest.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/tests/cputest.c b/tests/cputest.c
index a87aaa64d0..78521a5cf9 100644
--- a/tests/cputest.c
+++ b/tests/cputest.c
@@ -514,7 +514,7 @@ static int
cpuTestGetCPUModels(const struct data *data,
virDomainCapsCPUModels **models)
{
- virQEMUCaps *qemuCaps;
+ g_autoptr(virQEMUCaps) qemuCaps = NULL;
*models = NULL;
@@ -527,8 +527,6 @@ cpuTestGetCPUModels(const struct data *data,
*models = virQEMUCapsGetCPUModels(qemuCaps, VIR_DOMAIN_VIRT_KVM, NULL, NULL);
- virObjectUnref(qemuCaps);
-
return 0;
}
@@ -861,7 +859,7 @@ static int
cpuTestJSONCPUID(const void *arg)
{
const struct data *data = arg;
- virQEMUCaps *qemuCaps = NULL;
+ g_autoptr(virQEMUCaps) qemuCaps = NULL;
virCPUDef *cpu = NULL;
char *result = NULL;
int ret = -1;
@@ -883,7 +881,6 @@ cpuTestJSONCPUID(const void *arg)
ret = cpuTestCompareXML(data->arch, cpu, result);
cleanup:
- virObjectUnref(qemuCaps);
virCPUDefFree(cpu);
VIR_FREE(result);
return ret;
@@ -894,7 +891,7 @@ static int
cpuTestJSONSignature(const void *arg)
{
const struct data *data = arg;
- virQEMUCaps *qemuCaps = NULL;
+ g_autoptr(virQEMUCaps) qemuCaps = NULL;
virCPUData *hostData = NULL;
qemuMonitorCPUModelInfo *modelInfo;
int ret = -1;
@@ -909,7 +906,6 @@ cpuTestJSONSignature(const void *arg)
ret = cpuTestCompareSignature(data, hostData);
cleanup:
- virObjectUnref(qemuCaps);
virCPUDataFree(hostData);
return ret;
}
--
2.31.1