kmalloc: fix krealloc() not trying across arenas

This commit is contained in:
Lephe 2022-11-10 19:54:45 +01:00
parent 7b662987f8
commit bbda77769d
No known key found for this signature in database
GPG key ID: 1BBA026E13FC0495

View file

@ -112,6 +112,16 @@ void *krealloc(void *ptr, size_t size)
else
{
a->stats.total_failures++;
/* If reallocation within the original arena fails, try another
one. The memory copy behavior is sub-optimal (we copy the
new size which might be more than the original size) but
it's all we can do with this arena interface. */
rc = kmalloc(size, NULL);
if(rc)
{
memcpy(rc, ptr, size);
}
}
return rc;