Subject: bug#15978: FYI: patch: maint: minor cleanup: xmalloc+strcpy -> xmemdup

From: Jim Meyering <[email-masked]>
Date: Mon, 25 Nov 2013 17:55:07 -0800

From ed3994108bf15f0d7c35d5351d5bc613fa5d70cd Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email-masked]>
Date: Fri, 22 Nov 2013 20:13:53 -0800
Subject: [PATCH] maint: minor cleanup: xmalloc+strcpy -> xmemdup

* src/main.c (main): Replace an xmalloc+strcpy combination
with an equivalent use of xmemdup.
---
 src/main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/main.c b/src/main.c
index d9c7759..7ecf00a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2248,8 +2248,7 @@ main (int argc, char **argv)
     {
       /* A copy must be made in case of an xrealloc() or free() later.  */
       keycc = strlen (argv[optind]);
-      keys = xmalloc (keycc + 1);
-      strcpy (keys, argv[optind++]);
+      keys = xmemdup (argv[optind++], keycc + 1);
     }
   else
     usage (EXIT_TROUBLE);
-- 
1.8.5.rc2.6.gc6f1b92