tests: qemu: use g_autofree where possible

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
Ján Tomko
2020-07-28 21:57:28 +02:00
parent 9669287e85
commit 845fee02c1
12 changed files with 57 additions and 120 deletions

View File

@@ -220,15 +220,13 @@ virCapsPtr testQemuCapsInit(void)
}
if (virTestGetDebug()) {
char *caps_str;
g_autofree char *caps_str = NULL;
caps_str = virCapabilitiesFormatXML(caps);
if (!caps_str)
goto cleanup;
VIR_TEST_DEBUG("QEMU driver capabilities:\n%s", caps_str);
VIR_FREE(caps_str);
}
return caps;
@@ -496,7 +494,7 @@ testQemuGetLatestCapsForArch(const char *arch,
struct dirent *ent;
DIR *dir = NULL;
int rc;
char *fullsuffix = NULL;
g_autofree char *fullsuffix = NULL;
unsigned long maxver = 0;
unsigned long ver;
g_autofree char *maxname = NULL;
@@ -542,7 +540,6 @@ testQemuGetLatestCapsForArch(const char *arch,
ret = g_strdup_printf("%s/%s", TEST_QEMU_CAPS_PATH, maxname);
cleanup:
VIR_FREE(fullsuffix);
virDirClose(&dir);
return ret;
}