diff --git a/usr.bin/sort/mem.c b/usr.bin/sort/mem.c index dea37bb3a11..18794666da5 100644 --- a/usr.bin/sort/mem.c +++ b/usr.bin/sort/mem.c @@ -36,6 +36,16 @@ __FBSDID("$FreeBSD$"); #include "mem.h" +void* +sort_calloc(size_t nb, size_t size) +{ + void *ptr; + + if ((ptr = calloc(nb, size)) == NULL) + err(2, NULL); + return (ptr); +} + /* * malloc() wrapper. */ diff --git a/usr.bin/sort/mem.h b/usr.bin/sort/mem.h index cb21d6d4a22..6a4edcd5916 100644 --- a/usr.bin/sort/mem.h +++ b/usr.bin/sort/mem.h @@ -39,6 +39,7 @@ /* * mem.c */ +void *sort_calloc(size_t, size_t); void *sort_malloc(size_t); void sort_free(const void *ptr); void *sort_realloc(void *, size_t);