[PATCH 4/7] virTPMEmulatorInit: Don't use temporary variable to free path

Peter Krempa pkrempa at redhat.com
Thu Jun 11 09:43:36 UTC 2020


Use VIR_FREE directly.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/util/virtpm.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/util/virtpm.c b/src/util/virtpm.c
index c734bf941a..71c1a2ecb3 100644
--- a/src/util/virtpm.c
+++ b/src/util/virtpm.c
@@ -290,7 +290,6 @@ virTPMEmulatorInit(void)
         g_autofree char *path = NULL;
         bool findit = *prgs[i].path == NULL;
         struct stat statbuf;
-        char *tmp;

         if (!findit) {
             /* has executables changed? */
@@ -303,9 +302,7 @@ virTPMEmulatorInit(void)
         }

         if (findit) {
-            tmp = *prgs[i].path;
-            VIR_FREE(tmp);
-            *prgs[i].path = NULL;
+            VIR_FREE(*prgs[i].path);

             path = virFindFileInPath(prgs[i].name);
             if (!path) {
-- 
2.26.2




More information about the libvir-list mailing list