On a Monday in 2020, Ryan Gahagan wrote:
From: Barrett Schonefeld <bscho...@utexas.edu>

- src/util/virfile.c

Signed-off-by: Barrett Schonefeld <bscho...@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;

These two are freed inside the loop, I'd rather not mix that with
g_autofree.

Jano

-    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

Attachment: signature.asc
Description: PGP signature

Reply via email to