tpm: Fix memory leak and use existing variable instead

Use the existing variables rather then calling virTPMSwtpmXYZ().

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
Message-Id: <20190726205633.2041912-2-stefanb@linux.vnet.ibm.com>
This commit is contained in:
Stefan Berger 2019-07-26 16:56:30 -04:00 committed by Eric Blake
parent e1ff8a95c6
commit b8358f94e0

View File

@ -512,7 +512,7 @@ qemuTPMEmulatorRunSetup(const char *storagepath,
VIR_TPM_SWTPM_SETUP_FEATURE_CMDARG_PWDFILE_FD)) {
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED,
_("%s does not support passing a passphrase using a file "
"descriptor"), virTPMGetSwtpmSetup());
"descriptor"), swtpm_setup);
goto cleanup;
}
if ((pwdfile_fd = qemuTPMSetupEncryption(secretuuid, cmd)) < 0)
@ -652,7 +652,7 @@ qemuTPMEmulatorBuildCommand(virDomainTPMDefPtr tpm,
if (!virTPMSwtpmCapsGet(VIR_TPM_SWTPM_FEATURE_CMDARG_PWD_FD)) {
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED,
_("%s does not support passing passphrase via file descriptor"),
virTPMGetSwtpm());
swtpm);
goto error;
}