Fix bug in the function that searches for the allocation header
This commit is contained in:
parent
3fdd897291
commit
ca36e0dc35
@ -337,7 +337,7 @@ internal ArenaAllocHDR *find_alloc_header(BaseArena *arena, void *alloc_ptr) {
|
|||||||
max_search_end > arena_buf_start ? max_search_end : arena_buf_start;
|
max_search_end > arena_buf_start ? max_search_end : arena_buf_start;
|
||||||
|
|
||||||
bool match;
|
bool match;
|
||||||
while (current > search_end) {
|
for (; current >= search_end; --current) {
|
||||||
match = true;
|
match = true;
|
||||||
|
|
||||||
for (u64 i = 0; i < HDR_MAGIC_BYTE_COUNT; ++i) {
|
for (u64 i = 0; i < HDR_MAGIC_BYTE_COUNT; ++i) {
|
||||||
@ -350,9 +350,7 @@ internal ArenaAllocHDR *find_alloc_header(BaseArena *arena, void *alloc_ptr) {
|
|||||||
if (match) {
|
if (match) {
|
||||||
return (ArenaAllocHDR *)current;
|
return (ArenaAllocHDR *)current;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
current -= HDR_MAGIC_BYTE_COUNT;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user