Skip to content

Commit 1728aca

Browse files
committed
Add early NULL check to ta_free() (optimization)
1 parent d78f381 commit 1728aca

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tinyalloc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ bool ta_init(const void *base, const void *limit, const size_t heap_blocks, cons
134134
}
135135

136136
bool ta_free(void *free) {
137+
if (free == NULL) {
138+
return false;
139+
}
137140
Block *block = heap->used;
138141
Block *prev = NULL;
139142
while (block != NULL) {

0 commit comments

Comments
 (0)