mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
qemuxml2argvtest: Don't leak TPM unix path
When testing a domain XML with TPM we overwrite UNIX socket path to mimic what qemuTPMEmulatorPrepareHost() is doing (because *PrepareHost() functions are not called from the test). But we are not doing it fully - we need to set the chardev's type too so that virDomainTPMDefFree() can free the path. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
parent
a349c6c21c
commit
a02526a045
@ -551,9 +551,11 @@ testCompareXMLToArgv(const void *data)
|
|||||||
if (vm->def->tpm) {
|
if (vm->def->tpm) {
|
||||||
switch (vm->def->tpm->type) {
|
switch (vm->def->tpm->type) {
|
||||||
case VIR_DOMAIN_TPM_TYPE_EMULATOR:
|
case VIR_DOMAIN_TPM_TYPE_EMULATOR:
|
||||||
|
VIR_FREE(vm->def->tpm->data.emulator.source.data.file.path);
|
||||||
if (VIR_STRDUP(vm->def->tpm->data.emulator.source.data.file.path,
|
if (VIR_STRDUP(vm->def->tpm->data.emulator.source.data.file.path,
|
||||||
"/dev/test") < 0)
|
"/dev/test") < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
vm->def->tpm->data.emulator.source.type = VIR_DOMAIN_CHR_TYPE_FILE;
|
||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_TPM_TYPE_PASSTHROUGH:
|
case VIR_DOMAIN_TPM_TYPE_PASSTHROUGH:
|
||||||
case VIR_DOMAIN_TPM_TYPE_LAST:
|
case VIR_DOMAIN_TPM_TYPE_LAST:
|
||||||
|
Loading…
Reference in New Issue
Block a user