aboutsummaryrefslogtreecommitdiff
path: root/std/mem.zig
diff options
context:
space:
mode:
Diffstat (limited to 'std/mem.zig')
-rw-r--r--std/mem.zig3
1 files changed, 2 insertions, 1 deletions
diff --git a/std/mem.zig b/std/mem.zig
index 681054d087..28f25dcbcd 100644
--- a/std/mem.zig
+++ b/std/mem.zig
@@ -114,7 +114,8 @@ pub const Allocator = struct {
// n <= old_mem.len and the multiplication didn't overflow for that operation.
const byte_count = @sizeOf(T) * n;
- const byte_slice = self.reallocFn(self, @sliceToBytes(old_mem), byte_count, alignment) catch unreachable;
+ const old_byte_slice = @sliceToBytes(old_mem);
+ const byte_slice = self.reallocFn(self, old_byte_slice, byte_count, alignment) catch unreachable;
assert(byte_slice.len == byte_count);
return @bytesToSlice(T, @alignCast(alignment, byte_slice));
}