mirror of
https://github.com/GrapheneOS/hardened_malloc.git
synced 2025-04-19 22:10:19 +02:00
use min macro for realloc copy size
This commit is contained in:
parent
fe30f6c2ea
commit
3f1962dd2b
1 changed files with 2 additions and 2 deletions
4
malloc.c
4
malloc.c
|
@ -1023,7 +1023,7 @@ EXPORT void *h_realloc(void *old, size_t size) {
|
|||
}
|
||||
}
|
||||
|
||||
size_t copy_size = size < old_size ? size : old_size;
|
||||
size_t copy_size = min(size, old_size);
|
||||
if (copy_size >= MREMAP_MOVE_THRESHOLD) {
|
||||
void *new = allocate(size);
|
||||
if (new == NULL) {
|
||||
|
@ -1054,7 +1054,7 @@ EXPORT void *h_realloc(void *old, size_t size) {
|
|||
if (new == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
size_t copy_size = size < old_size ? size : old_size;
|
||||
size_t copy_size = min(size, old_size);
|
||||
if (size > 0 && size <= max_slab_size_class) {
|
||||
copy_size -= canary_size;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue