From 4d6d8d9a836223c28096039b6d9f87e360abc2ca Mon Sep 17 00:00:00 2001 From: sjhddh Date: Sat, 14 Mar 2026 06:57:04 +0000 Subject: [PATCH] fix(test): properly count successful reallocations in TrackingAllocator --- src/test_runner.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test_runner.zig b/src/test_runner.zig index 287e06b4..5d9d1cdd 100644 --- a/src/test_runner.zig +++ b/src/test_runner.zig @@ -501,7 +501,7 @@ pub const TrackingAllocator = struct { defer self.mutex.unlock(); const result = self.parent_allocator.rawResize(old_mem, alignment, new_len, ra); - self.reallocation_count += 1; // TODO: only if result is not null? + if (result) self.reallocation_count += 1; return result; } @@ -531,7 +531,7 @@ pub const TrackingAllocator = struct { defer self.mutex.unlock(); const result = self.parent_allocator.rawRemap(memory, alignment, new_len, ret_addr); - self.reallocation_count += 1; // TODO: only if result is not null? + if (result != null) self.reallocation_count += 1; return result; } };