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