mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
fix possible underflow in memory manager
This commit is contained in:
parent
dd738a6462
commit
1fd368d360
1 changed files with 3 additions and 0 deletions
|
@ -120,6 +120,9 @@ void* memory_managed_alloc(struct memtype *m, size_t len, size_t alignment)
|
|||
uintptr_t gap = 0;
|
||||
if (rem != 0) {
|
||||
gap = alignment - rem;
|
||||
if (gap > avail)
|
||||
// next aligned address isn't in this block anymore
|
||||
continue;
|
||||
cptr += gap;
|
||||
avail -= gap;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue