All the leaks.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3919 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2022-06-26 18:25:31 +00:00
parent 66ea0dadd0
commit ff2a0f0c3f
9 changed files with 50 additions and 24 deletions

@ -38,7 +38,15 @@ static void* _tf_realloc(int64_t* total, void* ptr, size_t size)
{
memcpy(&old_size, old_ptr, sizeof(size_t));
}
void* new_ptr = realloc(old_ptr, size ? size + sizeof(size_t) : 0);
void* new_ptr = NULL;
if (old_ptr && !size)
{
free(old_ptr);
}
else
{
new_ptr = realloc(old_ptr, size + sizeof(size_t));
}
if (new_ptr)
{
__atomic_add_fetch(total, (int64_t)size - (int64_t)old_size, __ATOMIC_RELAXED);