aboutsummaryrefslogtreecommitdiff
path: root/lib/std/testing/leak_count_allocator.zig
diff options
context:
space:
mode:
authorBenjamin Feng <benjamin.feng@glassdoor.com>2020-01-30 00:14:17 -0600
committerBenjamin Feng <benjamin.feng@glassdoor.com>2020-01-30 00:27:44 -0600
commit184128fd9e5bfcf9b9a1c1021cf1d8db03147c28 (patch)
tree44f6f584c0887273eb87ee42065ee5e03986039b /lib/std/testing/leak_count_allocator.zig
parent5c8e85f3884c581b17c8df1f19852189fe7c9412 (diff)
downloadzig-184128fd9e5bfcf9b9a1c1021cf1d8db03147c28.tar.gz
zig-184128fd9e5bfcf9b9a1c1021cf1d8db03147c28.zip
Fix testing.allocator wiring
Diffstat (limited to 'lib/std/testing/leak_count_allocator.zig')
-rw-r--r--lib/std/testing/leak_count_allocator.zig3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/std/testing/leak_count_allocator.zig b/lib/std/testing/leak_count_allocator.zig
index 6cdcfa2678..1d65b8c560 100644
--- a/lib/std/testing/leak_count_allocator.zig
+++ b/lib/std/testing/leak_count_allocator.zig
@@ -23,10 +23,11 @@ pub const LeakCountAllocator = struct {
fn realloc(allocator: *std.mem.Allocator, old_mem: []u8, old_align: u29, new_size: usize, new_align: u29) ![]u8 {
const self = @fieldParentPtr(LeakCountAllocator, "allocator", allocator);
+ var data = try self.internal_allocator.reallocFn(self.internal_allocator, old_mem, old_align, new_size, new_align);
if (old_mem.len == 0) {
self.count += 1;
}
- return self.internal_allocator.reallocFn(self.internal_allocator, old_mem, old_align, new_size, new_align);
+ return data;
}
fn shrink(allocator: *std.mem.Allocator, old_mem: []u8, old_align: u29, new_size: usize, new_align: u29) []u8 {