Fixed a small issue with Custom Mem handler and MexFreeBlock calculation

This commit is contained in:
ptitSeb committed 2021-04-19 14:44:09 +02:00
1 parent 337d08d466
commit 5b3eb577fc
1 file changed
+3 -1
+3 -1
View File
@@ -92,7 +92,9 @@ static int getMaxFreeBlock(void* block, size_t block_size)
int maxsize = 0;
while(m->prev.x32) { // while there is a subblock
if(!m->prev.fill && m->prev.size>maxsize) {
maxsize = m->prev.size-sizeof(blockmark_t); // remove the marker
maxsize = m->prev.size;
if(maxsize>sizeof(blockmark_t)) // remove the marker
maxsize -= sizeof(blockmark_t);
if((uintptr_t)block+maxsize>(uintptr_t)m)
return maxsize; // no block large enough left...
}