Another linked list bites the dust.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3928 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2022-07-12 01:51:15 +00:00
parent aee99af953
commit 1efc0fd73b
5 changed files with 94 additions and 70 deletions

View File

@ -174,9 +174,9 @@ void* tf_resize_vec(void* ptr, size_t size)
memcpy(&alloc_size, alloc_ptr, sizeof(size_t));
}
if (alloc_size >= 16 * size + sizeof(size_t))
if ((alloc_size >= 16 * size + sizeof(size_t)) || !size)
{
/* If we've dropped significantly in size, resize down. */
/* If we've dropped significantly in size or are freeing, resize down. */
return tf_realloc(ptr, size);
}
else if (alloc_size >= size + sizeof(size_t))