From: Alejandro Colomar Date: Mon, 4 Nov 2024 20:47:42 +0000 (+0100) Subject: lib/gshadow.c: sgetsgent(): Remove superfluous condition X-Git-Tag: 4.17.0-rc1~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=712278add163781a2257cdcf4bd8f91d6e222232;p=thirdparty%2Fshadow.git lib/gshadow.c: sgetsgent(): Remove superfluous condition If n was 0, it doesn't hurt to set it again to 0; and the list would be NULL, so it doesn't hurt free(3)ing it and setting to NULL again either. Signed-off-by: Alejandro Colomar --- diff --git a/lib/gshadow.c b/lib/gshadow.c index f2ce31f2d..15e1ac977 100644 --- a/lib/gshadow.c +++ b/lib/gshadow.c @@ -75,7 +75,8 @@ void endsgent (void) shadow = NULL; } -/*@observer@*//*@null@*/struct sgrp *sgetsgent (const char *string) +/*@observer@*//*@null@*/struct sgrp * +sgetsgent(const char *string) { static char *sgrbuf = NULL; static size_t sgrbuflen = 0; @@ -115,16 +116,14 @@ void endsgent (void) sgroup.sg_name = fields[0]; sgroup.sg_passwd = fields[1]; - if (0 != nadmins) { - nadmins = 0; - free (admins); - admins = NULL; - } - if (0 != nmembers) { - nmembers = 0; - free (members); - members = NULL; - } + + nadmins = 0; + free (admins); + admins = NULL; + nmembers = 0; + free (members); + members = NULL; + sgroup.sg_adm = build_list (fields[2], &admins, &nadmins); sgroup.sg_mem = build_list (fields[3], &members, &nmembers);