| author | |
| committer | |
| log | 28eed1f7b3a8654b941960232d7c707d88649d8d |
| tree | c6a46ecebdc3594ff324eec170b92572cc549a49 |
| parent | 8cf72cdfb13409aad9a5e2abc125a516e13c3aa6 |
Failing to forward free calls to the underlying allocator makes
`ValidationAllocator` unusable for testing allocators while checking for
leaks. This change allows allocators that wrap `std.testing.allocator`
to be tested with `std.heap.testAllocator()` in test decls without
reporting erroneous leaks.1 files changed, 3 insertions(+), 3 deletions(-)
lib/std/mem.zig+3-3| ... | ... | @@ -96,10 +96,10 @@ pub fn ValidationAllocator(comptime T: type) type { |
| 96 | 96 | log2_buf_align: u8, |
| 97 | 97 | ret_addr: usize, |
| 98 | 98 | ) void { |
| 99 | _ = ctx; | |
| 100 | _ = log2_buf_align; | |
| 101 | _ = ret_addr; | |
| 99 | const self = @ptrCast(*Self, @alignCast(@alignOf(Self), ctx)); | |
| 102 | 100 | assert(buf.len > 0); |
| 101 | const underlying = self.getUnderlyingAllocatorPtr(); | |
| 102 | underlying.rawFree(buf, log2_buf_align, ret_addr); | |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | pub fn reset(self: *Self) void { |