From 5fb01f4331fef93727f12cbb447136ad7fdac0e1 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Tue, 2 Apr 2013 20:42:46 +0100 Subject: [PATCH] newgrp: use xstrdup to check allocation succeeded Signed-off-by: Sami Kerola --- login-utils/newgrp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) -- 2.47.2