Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
//glibc_2.17-322.el7_9/malloc/malloc.c
static void*
_int_malloc(mstate av, size_t bytes)
{
...
for(;;) {
int iters = 0;
while ( (victim = unsorted_chunks(av)->bk) != unsorted_chunks(av)) {
bck = victim->bk;
if (__builtin_expect (victim->size <= 2 * SIZE_SZ, 0)
|| __builtin_expect (victim->size > av->system_mem, 0))
{
mutex_unlock(&av->mutex);
malloc_printerr (check_action, "malloc(): memory corruption",
[c1] chunk2mem (victim), av);
mutex_lock(&av->mutex);
}
size = chunksize(victim);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment