commit 08bb7c6c889594f2a1694c5bdf0f4648be4a8d66 (tree) parent 1493c3b5f3cedff8617380317aba71785ed3f10f Author: Andrew Kelley <andrew@ziglang.org> Date: Fri, 28 Mar 2025 17:20:35 -0700 free freeing wrong amount in thread pool impl Diffstat:
| M | lib/std/Thread/Pool.zig | | | 4 | ++-- |
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/std/Thread/Pool.zig b/lib/std/Thread/Pool.zig @@ -396,6 +396,6 @@ pub fn @"await"(userdata: ?*anyopaque, any_future: *std.Io.AnyFuture, result: [] const closure: *AsyncClosure = @ptrCast(@alignCast(any_future)); closure.reset_event.wait(); const base: [*]align(@alignOf(AsyncClosure)) u8 = @ptrCast(closure); - @memcpy(result, (base + @sizeOf(AsyncClosure))[0..result.len]); - thread_pool.allocator.free(base[0 .. @sizeOf(AsyncClosure) + result.len]); + @memcpy(result, closure.resultPointer()[0..result.len]); + thread_pool.allocator.free(base[0 .. closure.result_offset + result.len]); }