[PATCH] qemuxml2argvtest: Don't leak TPM unix path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 tests/qemuxml2argvtest.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index f630185de1..daa8d4ceeb 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -551,9 +551,11 @@ testCompareXMLToArgv(const void *data)
     if (vm->def->tpm) {
         switch (vm->def->tpm->type) {
         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,
                            "/dev/test") < 0)
                 goto cleanup;
+            vm->def->tpm->data.emulator.source.type = VIR_DOMAIN_CHR_TYPE_UNIX;
             break;
         case VIR_DOMAIN_TPM_TYPE_PASSTHROUGH:
         case VIR_DOMAIN_TPM_TYPE_LAST:
-- 
2.16.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux