Add Leak Detection to Ona Heap Allocator #15

Merged
kayomn merged 12 commits from ona-allocator-safety-tracker into main 2023-06-04 16:07:47 +02:00
1 changed files with 4 additions and 4 deletions
Showing only changes of commit 9c871aac97 - Show all commits

View File

@ -58,7 +58,7 @@ const Context = struct {
const target_allocation_info = @intToPtr(*AllocationInfo, @ptrToInt(allocation.ptr) - @sizeOf(AllocationInfo));
if (target_allocation_info.size != allocation.len) {
@panic("incorrect allocation length");
@panic("incorrect allocation length for deallocating");
}
if (self.allocation_info_head) |allocation_info_head| {
@ -87,7 +87,7 @@ const Context = struct {
}
}
@panic("double-free detected");
@panic("incorrect allocation address for deallocating");
}
///
@ -110,7 +110,7 @@ const Context = struct {
const target_allocation_info = @intToPtr(*AllocationInfo, @ptrToInt(allocation.ptr) - allocation_info_size);
if (target_allocation_info.size != allocation.len) {
@panic("incorrect allocation length");
@panic("incorrect allocation length for reallocating");
}
if (self.allocation_info_head) |allocation_info_head| {
@ -139,7 +139,7 @@ const Context = struct {
}
}
@panic("use-after-free detected");
@panic("incorrect allocation address for reallocating");
}
};