mirror of https://git.kore.io/kore.git
fix semantics for kore_calloc().
We were not returning zeroed out memory from kore_calloc() which goes against what calloc() does. Skip performance for now and simply just memset() the returned pointer from kore_malloc(). This should be sufficient enough for now.
This commit is contained in:
parent
3e84502235
commit
27da1dd741
|
@ -135,10 +135,17 @@ kore_realloc(void *ptr, size_t len)
|
|||
void *
|
||||
kore_calloc(size_t memb, size_t len)
|
||||
{
|
||||
void *ptr;
|
||||
size_t total;
|
||||
|
||||
if (SIZE_MAX / memb < len)
|
||||
fatal("kore_calloc(): memb * len > SIZE_MAX");
|
||||
|
||||
return (kore_malloc(memb * len));
|
||||
total = memb * len;
|
||||
ptr = kore_malloc(total);
|
||||
memset(ptr, 0, total);
|
||||
|
||||
return (ptr);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in New Issue