1
0
Fork 0
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:
Georg Reinke 2017-03-28 12:52:21 +02:00
parent dd738a6462
commit 1fd368d360

View file

@ -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;
}