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

- src/util/virutil.c

Signed-off-by: Barrett Schonefeld <bscho...@utexas.edu>
---
src/util/virutil.c | 33 ++++++++++-----------------------
1 file changed, 10 insertions(+), 23 deletions(-)

diff --git a/src/util/virutil.c b/src/util/virutil.c
index a0cd0f1bcd..d4b864d5cb 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -598,7 +598,7 @@ char *virGetUserRuntimeDirectory(void)
static int
virGetUserEnt(uid_t uid, char **name, gid_t *group, char **dir, char **shell, 
bool quiet)
{
-    char *strbuf;
+    g_autofree char *strbuf = NULL;
    struct passwd pwbuf;
    struct passwd *pw = NULL;
    long val = sysconf(_SC_GETPW_R_SIZE_MAX);
@@ -668,13 +668,12 @@ virGetUserEnt(uid_t uid, char **name, gid_t *group, char 
**dir, char **shell, bo
        if (shell)
            VIR_FREE(*shell);
    }
-    VIR_FREE(strbuf);
    return ret;
}

static char *virGetGroupEnt(gid_t gid)
{
-    char *strbuf;
+    g_autofree char *strbuf = NULL;

There are multiple cases of VIR_FREE(strbuf) left in this function.

    char *ret;
    struct group grbuf;
    struct group *gr = NULL;

Jano

Attachment: signature.asc
Description: PGP signature

Reply via email to