mirror of
https://github.com/GrapheneOS/hardened_malloc.git
synced 2024-12-18 20:34:22 -05:00
add stats tracking to special large realloc paths
This commit is contained in:
parent
96a9bcf3a1
commit
85c5c3736c
@ -1394,6 +1394,7 @@ EXPORT void *h_realloc(void *old, size_t size) {
|
|||||||
fatal_error("invalid realloc");
|
fatal_error("invalid realloc");
|
||||||
}
|
}
|
||||||
region->size = size;
|
region->size = size;
|
||||||
|
stats_large_deallocate(ra, old_size - size);
|
||||||
mutex_unlock(&ra->lock);
|
mutex_unlock(&ra->lock);
|
||||||
|
|
||||||
thread_seal_metadata();
|
thread_seal_metadata();
|
||||||
@ -1416,6 +1417,7 @@ EXPORT void *h_realloc(void *old, size_t size) {
|
|||||||
fatal_error("invalid realloc");
|
fatal_error("invalid realloc");
|
||||||
}
|
}
|
||||||
region->size = size;
|
region->size = size;
|
||||||
|
stats_large_allocate(ra, extra);
|
||||||
mutex_unlock(&ra->lock);
|
mutex_unlock(&ra->lock);
|
||||||
|
|
||||||
thread_seal_metadata();
|
thread_seal_metadata();
|
||||||
@ -1438,6 +1440,7 @@ EXPORT void *h_realloc(void *old, size_t size) {
|
|||||||
fatal_error("invalid realloc");
|
fatal_error("invalid realloc");
|
||||||
}
|
}
|
||||||
regions_delete(region);
|
regions_delete(region);
|
||||||
|
stats_large_deallocate(ra, old_size);
|
||||||
mutex_unlock(&ra->lock);
|
mutex_unlock(&ra->lock);
|
||||||
|
|
||||||
if (memory_remap_fixed(old, old_size, new, size)) {
|
if (memory_remap_fixed(old, old_size, new, size)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user