summaryrefslogtreecommitdiff
path: root/Xtranslcl.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2011-11-30 18:11:15 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2011-12-06 11:18:00 -0800
commita0bfb4fefd20b396e3d88eff0c60602fc436dad5 (patch)
tree6924964157285000819bdf6816ace59475fd218b /Xtranslcl.c
parentb89e1b45198c48996750b5da3d715c10f974243f (diff)
downloadxorg-lib-libxtrans-a0bfb4fefd20b396e3d88eff0c60602fc436dad5.tar.gz
Replace malloc(strlen)+strcpy with strdup
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
Diffstat (limited to 'Xtranslcl.c')
-rw-r--r--Xtranslcl.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/Xtranslcl.c b/Xtranslcl.c
index 8a5e718..925ba01 100644
--- a/Xtranslcl.c
+++ b/Xtranslcl.c
@@ -1671,17 +1671,13 @@ TRANS(LocalInitTransports)(const char *protocol)
if( strcmp(protocol,"local") && strcmp(protocol,"LOCAL") )
{
- workingXLOCAL=freeXLOCAL=(char *)malloc (strlen (protocol) + 1);
- if (workingXLOCAL)
- strcpy (workingXLOCAL, protocol);
+ workingXLOCAL = freeXLOCAL = strdup (protocol);
}
else {
XLOCAL=(char *)getenv("XLOCAL");
if(XLOCAL==NULL)
XLOCAL=DEF_XLOCAL;
- workingXLOCAL=freeXLOCAL=(char *)malloc (strlen (XLOCAL) + 1);
- if (workingXLOCAL)
- strcpy (workingXLOCAL, XLOCAL);
+ workingXLOCAL = freeXLOCAL = strdup (XLOCAL);
}
}