| ... | ... | @@ -33,6 +33,9 @@ pub const LeakCountAllocator = struct { |
| 33 | 33 | fn shrink(allocator: *std.mem.Allocator, old_mem: []u8, old_align: u29, new_size: usize, new_align: u29) []u8 { |
| 34 | 34 | const self = @fieldParentPtr(LeakCountAllocator, "allocator", allocator); |
| 35 | 35 | if (new_size == 0) { |
| 36 | if (self.count == 0) { |
| 37 | std.debug.panic("error - too many calls to free, most likely double free", .{}); |
| 38 | } |
| 36 | 39 | self.count -= 1; |
| 37 | 40 | } |
| 38 | 41 | return self.internal_allocator.shrinkFn(self.internal_allocator, old_mem, old_align, new_size, new_align); |