]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
newgrp: use xstrdup to check allocation succeeded
authorSami Kerola <kerolasa@iki.fi>
Tue, 2 Apr 2013 19:42:46 +0000 (20:42 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 5 Apr 2013 11:55:50 +0000 (13:55 +0200)
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
login-utils/newgrp.c

index 62695474e4e251c9dd36f3a59e6d06e55d6593d8..55dad1bb44eada9705c97c30645d2b821c3c3743 100644 (file)
@@ -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)