Skip to content

Commit

Permalink
Add early NULL check to ta_free() (optimization)
Browse files Browse the repository at this point in the history
  • Loading branch information
jlindgren90 committed Mar 25, 2024
1 parent d78f381 commit 1728aca
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tinyalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ bool ta_init(const void *base, const void *limit, const size_t heap_blocks, cons
}

bool ta_free(void *free) {
if (free == NULL) {
return false;
}
Block *block = heap->used;
Block *prev = NULL;
while (block != NULL) {
Expand Down

0 comments on commit 1728aca

Please sign in to comment.