From a0bfb4fefd20b396e3d88eff0c60602fc436dad5 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 30 Nov 2011 18:11:15 -0800 Subject: Replace malloc(strlen)+strcpy with strdup Signed-off-by: Alan Coopersmith Reviewed-by: Mark Kettenis --- Xtranslcl.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'Xtranslcl.c') 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); } } -- cgit v1.2.3