diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-09-28 19:39:20 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-09-28 19:39:34 -0700 |
commit | eb5ed59c623aa360677f62a7fd6e398ee9f3cab5 (patch) | |
tree | 95ddadc59084b4488e31e8c4023fa4b5672dd322 | |
parent | b67f0df2dbfa372417d0687e26704635e2d10034 (diff) |
convert strlen/malloc/strcpy combo to strdup
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | process.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -778,10 +778,8 @@ auth_initialize(char *authfilename) xauth_head = head; } - n = strlen (authfilename); - xauth_filename = malloc (n + 1); - if (xauth_filename) strcpy (xauth_filename, authfilename); - else { + xauth_filename = strdup(authfilename); + if (!xauth_filename) { fprintf(stderr,"cannot allocate memory\n"); return -1; } |