mirror of
https://github.com/espressif/tlsf.git
synced 2026-09-18 15:10:10 +00:00
Merge pull request #2 from ralphyon/master
Fix block_size_max handling in adjust_request_size
This commit is contained in:
@@ -492,10 +492,15 @@ static void* align_ptr(const void* ptr, size_t align)
|
||||
static size_t adjust_request_size(size_t size, size_t align)
|
||||
{
|
||||
size_t adjust = 0;
|
||||
if (size && size < block_size_max)
|
||||
if (size)
|
||||
{
|
||||
const size_t aligned = align_up(size, align);
|
||||
adjust = tlsf_max(aligned, block_size_min);
|
||||
|
||||
/* aligned sized must not exceed block_size_max or we'll go out of bounds on sl_bitmap */
|
||||
if (aligned < block_size_max)
|
||||
{
|
||||
adjust = tlsf_max(aligned, block_size_min);
|
||||
}
|
||||
}
|
||||
return adjust;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user