mirror of
https://github.com/GrapheneOS/hardened_malloc.git
synced 2024-12-20 13:24:21 -05:00
fix calloc for nmemb == 0 and !ZERO_ON_FREE
This commit is contained in:
parent
8a863ae847
commit
4dc3385bc0
@ -1087,7 +1087,7 @@ EXPORT void *h_calloc(size_t nmemb, size_t size) {
|
|||||||
total_size = adjust_size_for_canaries(total_size);
|
total_size = adjust_size_for_canaries(total_size);
|
||||||
void *p = allocate(total_size);
|
void *p = allocate(total_size);
|
||||||
thread_seal_metadata();
|
thread_seal_metadata();
|
||||||
if (!ZERO_ON_FREE && likely(p != NULL) && size && size <= max_slab_size_class) {
|
if (!ZERO_ON_FREE && likely(p != NULL) && total_size && total_size <= max_slab_size_class) {
|
||||||
memset(p, 0, total_size - canary_size);
|
memset(p, 0, total_size - canary_size);
|
||||||
}
|
}
|
||||||
return p;
|
return p;
|
||||||
|
Loading…
Reference in New Issue
Block a user