[PATCH 03/30] util: convert pointers to use g_autofree
Ján Tomko
jtomko at redhat.com
Tue Nov 24 11:44:49 UTC 2020
On a Monday in 2020, Ryan Gahagan wrote:
>From: Barrett Schonefeld <bschoney at utexas.edu>
>
>- src/util/virutil.c
>
>Signed-off-by: Barrett Schonefeld <bschoney at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20201124/81726158/attachment-0001.sig>
More information about the libvir-list
mailing list