diff options
| author | Coleman Broaddus <coleman.broaddus@gmail.com> | 2021-09-22 05:09:16 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-22 12:09:16 +0300 |
| commit | e14fcd60cb11d731ca19f97e5b0b6247aa7cf07b (patch) | |
| tree | 8bf800c13de400f3c8492225a385e0f4552430f0 /lib/std/mem/Allocator.zig | |
| parent | 4afe4bdfe7dda638b35a9d388aac9a53d18cc4ba (diff) | |
| download | zig-e14fcd60cb11d731ca19f97e5b0b6247aa7cf07b.tar.gz zig-e14fcd60cb11d731ca19f97e5b0b6247aa7cf07b.zip | |
FIX resize() for non u8 element types. (#9806)
Diffstat (limited to 'lib/std/mem/Allocator.zig')
| -rw-r--r-- | lib/std/mem/Allocator.zig | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/std/mem/Allocator.zig b/lib/std/mem/Allocator.zig index 9ea7aeb90e..a76c27f5a0 100644 --- a/lib/std/mem/Allocator.zig +++ b/lib/std/mem/Allocator.zig @@ -313,7 +313,7 @@ pub fn resize(self: *Allocator, old_mem: anytype, new_n: usize) Error!@TypeOf(ol const new_byte_count = math.mul(usize, @sizeOf(T), new_n) catch return Error.OutOfMemory; const rc = try self.resizeFn(self, old_byte_slice, Slice.alignment, new_byte_count, 0, @returnAddress()); assert(rc == new_byte_count); - const new_byte_slice = old_mem.ptr[0..new_byte_count]; + const new_byte_slice = old_byte_slice.ptr[0..new_byte_count]; return mem.bytesAsSlice(T, new_byte_slice); } |
