gid_t swtpm_group)
{
int ret = -1;
- char *swtpmStorageDir = g_path_get_dirname(storagepath);
+ g_autofree char *swtpmStorageDir = g_path_get_dirname(storagepath);
if (qemuTPMEmulatorInitStorage(swtpmStorageDir) < 0)
goto cleanup;
ret = 0;
cleanup:
- VIR_FREE(swtpmStorageDir);
-
return ret;
}
const char *shortName)
{
char *pidfile = NULL;
- char *devicename = NULL;
+ g_autofree char *devicename = NULL;
devicename = g_strdup_printf("%s-swtpm", shortName);
pidfile = virPidFileBuildPath(swtpmStateDir, devicename);
- VIR_FREE(devicename);
-
return pidfile;
}
int exitstatus;
int ret = -1;
char uuid[VIR_UUID_STRING_BUFLEN];
- char *vmid = NULL;
+ g_autofree char *vmid = NULL;
g_autofree char *swtpm_setup = virTPMGetSwtpmSetup();
VIR_AUTOCLOSE pwdfile_fd = -1;
ret = 0;
cleanup:
- VIR_FREE(vmid);
virCommandFree(cmd);
return ret;
{
virCommandPtr cmd = NULL;
bool created = false;
- char *pidfile;
+ g_autofree char *pidfile = NULL;
g_autofree char *swtpm = virTPMGetSwtpm();
VIR_AUTOCLOSE pwdfile_fd = -1;
VIR_AUTOCLOSE migpwdfile_fd = -1;
virCommandAddArg(cmd, "--pid");
virCommandAddArgFormat(cmd, "file=%s", pidfile);
- VIR_FREE(pidfile);
if (tpm->data.emulator.hassecretuuid) {
if (!virTPMSwtpmCapsGet(VIR_TPM_SWTPM_FEATURE_CMDARG_PWD_FD)) {
const char *shortName)
{
virCommandPtr cmd;
- char *pathname;
- char *errbuf = NULL;
+ g_autofree char *pathname = NULL;
+ g_autofree char *errbuf = NULL;
g_autofree char *swtpm_ioctl = virTPMGetSwtpmIoctl();
if (!swtpm_ioctl)
unlink(pathname);
cleanup:
- VIR_FREE(pathname);
- VIR_FREE(errbuf);
+ return;
}
{
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
int ret = 0;
- char *shortName = NULL;
+ g_autofree char *shortName = NULL;
switch (def->tpm->type) {
case VIR_DOMAIN_TPM_TYPE_EMULATOR:
}
cleanup:
- VIR_FREE(shortName);
virObjectUnref(cfg);
return ret;
virDomainObjPtr vm)
{
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
- char *shortName = NULL;
+ g_autofree char *shortName = NULL;
switch (vm->def->tpm->type) {
case VIR_DOMAIN_TPM_TYPE_EMULATOR:
}
cleanup:
- VIR_FREE(shortName);
virObjectUnref(cfg);
}
virCgroupPtr cgroup)
{
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
- char *shortName = NULL;
+ g_autofree char *shortName = NULL;
int ret = -1, rc;
pid_t pid;
ret = 0;
cleanup:
- VIR_FREE(shortName);
virObjectUnref(cfg);
return ret;