Initialize an autofree'd variable with NULL that causes crashes
if a TPM 1.2 is used and the variable doesn't get a value assigned.

Signed-off-by: Stefan Berger <[email protected]>
---
 src/qemu/qemu_tpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c
index b305313ad2..1992b596cb 100644
--- a/src/qemu/qemu_tpm.c
+++ b/src/qemu/qemu_tpm.c
@@ -610,7 +610,7 @@ qemuTPMEmulatorReconfigure(const char *storagepath,
 {
     g_autoptr(virCommand) cmd = NULL;
     int exitstatus;
-    g_autofree char *activePcrBanksStr;
+    g_autofree char *activePcrBanksStr = NULL;
     g_autofree char *swtpm_setup = virTPMGetSwtpmSetup();
     VIR_AUTOCLOSE pwdfile_fd = -1;
 
-- 
2.31.1

Reply via email to