[PATCH 17/30] util: convert pointers to use g_autofree

Ryan Gahagan rgahagan at cs.utexas.edu
Mon Nov 23 22:09:38 UTC 2020


From: Barrett Schonefeld <bschoney at utexas.edu>

- src/util/virfile.c

Signed-off-by: Barrett Schonefeld <bschoney at utexas.edu>
---
 src/util/virfile.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/util/virfile.c b/src/util/virfile.c
index f57272ca2f..38207f1948 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -3328,9 +3328,9 @@ virFileIsSharedFixFUSE(const char *path,
     FILE *f = NULL;
     struct mntent mb;
     char mntbuf[1024];
-    char *mntDir = NULL;
-    char *mntType = NULL;
-    char *canonPath = NULL;
+    g_autofree char *mntDir = NULL;
+    g_autofree char *mntType = NULL;
+    g_autofree char *canonPath = NULL;
     size_t maxMatching = 0;
     int ret = -1;
 
@@ -3381,9 +3381,6 @@ virFileIsSharedFixFUSE(const char *path,
 
     ret = 0;
  cleanup:
-    VIR_FREE(canonPath);
-    VIR_FREE(mntType);
-    VIR_FREE(mntDir);
     endmntent(f);
     return ret;
 }
-- 
2.29.0




More information about the libvir-list mailing list