{
struct passwd *res = NULL;
size_t sz;
- char *tmp;
int x;
if (!pwdbuf || !username)
#endif
sz = 16384;
- tmp = realloc(*pwdbuf, sz);
- if (!tmp) {
- free(*pwdbuf);
- *pwdbuf = NULL;
- return NULL;
- }
- *pwdbuf = tmp;
+ *pwdbuf = xrealloc(*pwdbuf, sz);
x = getpwnam_r(username, pwd, *pwdbuf, sz, &res);
if (!res) {
int len, i;
termenv = getenv("TERM");
- termenv = termenv ? strdup(termenv) : "dumb";
+ termenv = termenv ? xstrdup(termenv) : "dumb";
/* destroy environment unless user has requested preservation (-p) */
if (!cxt->keep_env) {
- environ = (char **) malloc(sizeof(char *));
+ environ = (char **) xmalloc(sizeof(char *));
memset(environ, 0, sizeof(char *));
}
strcasecmp(p, domain) == 0)
*p = 0;
- cxt.hostname = strdup(optarg);
+ cxt.hostname = xstrdup(optarg);
{
struct addrinfo hints, *info = NULL;
if (*argv) {
char *p = *argv;
- cxt.username = strdup(p);
+ cxt.username = xstrdup(p);
/* wipe name - some people mistype their password here */
/* (of course we are too late, but perhaps this helps a little ..) */