aboutsummaryrefslogtreecommitdiff
path: root/libexec/rtld-elf/xmalloc.c
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2012-03-23 12:04:44 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2012-03-23 12:04:44 +0000
commitf7b343037fb3ed739ca766e002944bef829bdf0e (patch)
treedf3d6bfcebd234818868a70c97411becf9807e8f /libexec/rtld-elf/xmalloc.c
parent3b5683fce6f6fa72bfb0c0eb27ed6c50e5781b2d (diff)
Notes
Diffstat (limited to 'libexec/rtld-elf/xmalloc.c')
-rw-r--r--libexec/rtld-elf/xmalloc.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/libexec/rtld-elf/xmalloc.c b/libexec/rtld-elf/xmalloc.c
index 3783685dc826..178f49bda0df 100644
--- a/libexec/rtld-elf/xmalloc.c
+++ b/libexec/rtld-elf/xmalloc.c
@@ -57,12 +57,13 @@ xmalloc(size_t size)
}
char *
-xstrdup(const char *s)
+xstrdup(const char *str)
{
- char *p = strdup(s);
- if (p == NULL) {
- rtld_fdputstr(STDERR_FILENO, "Out of memory\n");
- _exit(1);
- }
- return p;
+ char *copy;
+ size_t len;
+
+ len = strlen(str) + 1;
+ copy = xmalloc(len);
+ memcpy(copy, str, len);
+ return (copy);
}