Skip to content

Commit

Permalink
Fixed an issue where b2_numAllocs could get a negative value, causing…
Browse files Browse the repository at this point in the history
… an assert/crash under certain conditions.
  • Loading branch information
znakeeye committed Feb 16, 2025
1 parent d16057c commit 475d09b
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,11 @@ void* b2Alloc(int32 size)

void b2Free(void* mem)
{
b2_numAllocs--;
b2_freeCallback(mem, b2_callbackData);
if (mem != NULL)
{
b2_numAllocs--;
b2_freeCallback(mem, b2_callbackData);
}
}

void b2SetNumAllocs(const int32 numAllocs)
Expand Down

0 comments on commit 475d09b

Please sign in to comment.