diff options
author | Jason Evans <jasone@FreeBSD.org> | 2006-01-12 07:28:21 +0000 |
---|---|---|
committer | Jason Evans <jasone@FreeBSD.org> | 2006-01-12 07:28:21 +0000 |
commit | 52828c0e9cfdf1681a8c16cf313294ad1413ac25 (patch) | |
tree | 25770955017440672d2cba68e6d8c382b53d9f75 /libexec | |
parent | 0b61bced98b63acd9e76e015a0b46bce86a0bdd4 (diff) |
Notes
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/rtld-elf/malloc.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libexec/rtld-elf/malloc.c b/libexec/rtld-elf/malloc.c index 2fe69a78b22e0..3da5bee3b7fa5 100644 --- a/libexec/rtld-elf/malloc.c +++ b/libexec/rtld-elf/malloc.c @@ -236,6 +236,22 @@ malloc(nbytes) return ((char *)(op + 1)); } +void * +calloc(size_t num, size_t size) +{ + void *ret; + + if (size != 0 && (num * size) / size != num) { + /* size_t overflow. */ + return (NULL); + } + + if ((ret = malloc(num * size)) != NULL) + memset(ret, 0, num * size); + + return (ret); +} + /* * Allocate more memory to the indicated bucket. */ |