blob: 35b45c0c9064d38dfa85278919128e8aadbf13ad (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
#include <errno.h>
#include <stdint.h>
#include <stdlib.h>
#include "alloc.h"
#include "errors.h"
void *
bufalloc(void *ptr, size_t nmemb, size_t size)
{
if (size > SIZE_MAX / nmemb) {
errno = EOVERFLOW;
err("%s:", __func__);
}
if ((ptr = realloc(ptr, nmemb * size)) == NULL)
err("%s:", __func__);
return ptr;
}
|