aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 19418bd6686..f9bcaed0117 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -796,8 +796,10 @@ xpalloc (void *pa, ptrdiff_t *nitems, ptrdiff_t nitems_incr_min,
796char * 796char *
797xstrdup (const char *s) 797xstrdup (const char *s)
798{ 798{
799 ptrdiff_t size;
799 eassert (s); 800 eassert (s);
800 return strcpy (xmalloc (strlen (s) + 1), s); 801 size = strlen (s) + 1;
802 return memcpy (xmalloc (size), s, size);
801} 803}
802 804
803/* Like putenv, but (1) use the equivalent of xmalloc and (2) the 805/* Like putenv, but (1) use the equivalent of xmalloc and (2) the