From: Sami Kerola Date: Tue, 2 Apr 2013 19:42:46 +0000 (+0100) Subject: newgrp: use xstrdup to check allocation succeeded X-Git-Tag: v2.23-rc2~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5fb01f4331fef93727f12cbb447136ad7fdac0e1;p=thirdparty%2Futil-linux.git newgrp: use xstrdup to check allocation succeeded Signed-off-by: Sami Kerola --- diff --git a/login-utils/newgrp.c b/login-utils/newgrp.c index 62695474e4..55dad1bb44 100644 --- a/login-utils/newgrp.c +++ b/login-utils/newgrp.c @@ -32,6 +32,7 @@ #include "closestream.h" #include "nls.h" #include "pathnames.h" +#include "xalloc.h" /* try to read password from gshadow */ static char *get_gshadow_pwd(char *groupname) @@ -67,7 +68,7 @@ static char *get_gshadow_pwd(char *groupname) } } fclose(f); - return pwd ? strdup(pwd) : NULL; + return pwd ? xstrdup(pwd) : NULL; } static int allow_setgid(struct passwd *pe, struct group *ge)