[PATCH:libFS 6/7] Replace malloc(strlen + 1); strcpy() with strdup()

Alan Coopersmith alan.coopersmith at oracle.com
Tue Jan 7 16:02:26 PST 2014


Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 src/FSOpenServ.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/FSOpenServ.c b/src/FSOpenServ.c
index b8ccb2f..faebe13 100644
--- a/src/FSOpenServ.c
+++ b/src/FSOpenServ.c
@@ -127,10 +127,9 @@ FSOpenServer(const char *server)
 	return (FSServer *) NULL;
     }
 
-    if ((svr->server_name = FSmalloc(strlen(server) + 1)) == NULL) {
+    if ((svr->server_name = strdup(server)) == NULL) {
 	goto fail;
     }
-    (void) strcpy(svr->server_name, server);
 
     if ((svr->trans_conn = _FSConnectServer(svr->server_name)) == NULL) {
 	goto fail;
-- 
1.7.9.2



More information about the xorg-devel mailing list