blob: 4a81cda15e1ce2dc4643b215995f6bdc999611c2 [file] [log] [blame]
/*
* calloc.c
*/
#include <errno.h>
#include <stdlib.h>
#include <string.h>
void *calloc(size_t nmemb, size_t size)
{
unsigned long prod;
if (__builtin_umull_overflow(nmemb, size, &prod)) {
errno = ENOMEM;
return NULL;
}
return zalloc(prod);
}