char *
virTestLoadFilePath(const char *p, ...)
{
- char *path = NULL;
+ g_autofree char *path = NULL;
char *ret = NULL;
va_list ap;
cleanup:
va_end(ap);
- VIR_FREE(path);
return ret;
}
virTestLoadFileJSON(const char *p, ...)
{
virJSONValuePtr ret = NULL;
- char *jsonstr = NULL;
- char *path = NULL;
+ g_autofree char *jsonstr = NULL;
+ g_autofree char *path = NULL;
va_list ap;
va_start(ap, p);
cleanup:
va_end(ap);
- VIR_FREE(jsonstr);
- VIR_FREE(path);
return ret;
}
virTestRewrapFile(const char *filename)
{
int ret = -1;
- char *script = NULL;
+ g_autofree char *script = NULL;
virCommandPtr cmd = NULL;
if (!(virStringHasSuffix(filename, ".args") ||
ret = 0;
cleanup:
- VIR_FREE(script);
virCommandFree(cmd);
return ret;
}
const char *filename)
{
int ret = -1;
- char *filecontent = NULL;
- char *fixedcontent = NULL;
+ g_autofree char *filecontent = NULL;
+ g_autofree char *fixedcontent = NULL;
const char *cmpcontent = actual;
if (!cmpcontent)
ret = 0;
failure:
- VIR_FREE(fixedcontent);
- VIR_FREE(filecontent);
return ret;
}
{
int ret = -1;
const char *path = getenv("PATH");
- char *new_path = NULL;
+ g_autofree char *new_path = NULL;
if (path) {
if (strstr(path, abs_builddir) != path)
ret = 0;
cleanup:
- VIR_FREE(new_path);
return ret;
}
if (virTestGetDebug() > 1) {
- char *caps_str;
+ g_autofree char *caps_str = NULL;
caps_str = virCapabilitiesFormatXML(caps);
if (!caps_str)
goto error;
VIR_TEST_DEBUG("Generic driver capabilities:\n%s", caps_str);
-
- VIR_FREE(caps_str);
}
return caps;
unsigned int parseFlags,
testCompareDomXML2XMLResult expectResult)
{
- char *actual = NULL;
+ g_autofree char *actual = NULL;
int ret = -1;
testCompareDomXML2XMLResult result;
virDomainDefPtr def = NULL;
expectResult, result);
}
- VIR_FREE(actual);
virDomainDefFree(def);
return ret;
}