mirror of
https://git.planet-casio.com/Lephenixnoir/gint.git
synced 2025-01-01 06:23:35 +01:00
kmalloc: fix krealloc() not trying across arenas
This commit is contained in:
parent
7b662987f8
commit
bbda77769d
1 changed files with 10 additions and 0 deletions
|
@ -112,6 +112,16 @@ void *krealloc(void *ptr, size_t size)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
a->stats.total_failures++;
|
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;
|
return rc;
|
||||||
|
|
Loading…
Reference in a new issue