From: Sami Kerola Date: Fri, 13 Nov 2020 23:04:43 +0000 (+0000) Subject: login: use xalloc memory allocation helpers everywhere X-Git-Tag: v2.37-rc1~248 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b04f1835782ea8418c09333e9b95e45d167ef4ff;p=thirdparty%2Futil-linux.git login: use xalloc memory allocation helpers everywhere Apart two function calls login(1) already used xalloc functions. If there was a time when login tried to gracefully handle allocation errors that has not been true for long time. Signed-off-by: Sami Kerola --- diff --git a/login-utils/login.c b/login-utils/login.c index b2b705ad53..b392e28e41 100644 --- a/login-utils/login.c +++ b/login-utils/login.c @@ -242,13 +242,10 @@ static void process_title_init(int argc, char **argv) for (i = 0; envp[i] != NULL; i++) continue; - environ = malloc(sizeof(char *) * (i + 1)); - if (environ == NULL) - return; + environ = xmalloc(sizeof(char *) * (i + 1)); for (i = 0; envp[i] != NULL; i++) - if ((environ[i] = strdup(envp[i])) == NULL) - return; + environ[i] = xstrdup(envp[i]); environ[i] = NULL; if (i > 0)