summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2011-09-28 19:39:20 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2011-09-28 19:39:34 -0700
commiteb5ed59c623aa360677f62a7fd6e398ee9f3cab5 (patch)
tree95ddadc59084b4488e31e8c4023fa4b5672dd322
parentb67f0df2dbfa372417d0687e26704635e2d10034 (diff)
convert strlen/malloc/strcpy combo to strdup
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--process.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/process.c b/process.c
index a4021c7..88424d3 100644
--- a/process.c
+++ b/process.c
@@ -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;
}