Skip to content

Commit

Permalink
Fix allocation tracker
Browse files Browse the repository at this point in the history
initialize reallocated block
  • Loading branch information
tcdude committed Mar 22, 2023
1 parent f318eb0 commit 4a6fdfe
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Sources/krink/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ static void kr_alloctrack_malloc(void *ptr, size_t size) {
}
kr_allocs = (kr_alloc_t *)realloc(kr_allocs, 2 * kr_allocs_count * sizeof(kr_alloc_t));
assert(kr_allocs);
for (int i = kr_allocs_count; i < 2 * kr_allocs_count; ++i) {
kr_allocs[i].ptr = NULL;
kr_allocs[i].size = 0;
}
kr_allocs[kr_allocs_count].ptr = ptr;
kr_allocs[kr_allocs_count].size = size;
kr_allocs_count *= 2;
Expand Down

0 comments on commit 4a6fdfe

Please sign in to comment.