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
Signed by untrusted user: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
1 changed files with 10 additions and 0 deletions

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;