[libvirt] [PATCH 3/8] qemu: tpm: Use g_autofree in qemuTPMEmulatorGetPid

Peter Krempa pkrempa at redhat.com
Wed Nov 13 13:07:04 UTC 2019


Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_tpm.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c
index 62b9f803bd..40136c4410 100644
--- a/src/qemu/qemu_tpm.c
+++ b/src/qemu/qemu_tpm.c
@@ -277,15 +277,13 @@ qemuTPMEmulatorGetPid(const char *swtpmStateDir,
 {
     int ret;
     g_autofree char *swtpm = virTPMGetSwtpm();
-    char *pidfile = qemuTPMEmulatorCreatePidFilename(swtpmStateDir,
-                                                     shortName);
+    g_autofree char *pidfile = qemuTPMEmulatorCreatePidFilename(swtpmStateDir,
+                                                                shortName);
     if (!pidfile)
         return -ENOMEM;

     ret = virPidFileReadPathIfAlive(pidfile, pid, swtpm);

-    VIR_FREE(pidfile);
-
     return ret;
 }

-- 
2.23.0




More information about the libvir-list mailing list