aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Thread
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2025-03-28 17:20:35 -0700
committerAndrew Kelley <andrew@ziglang.org>2025-10-29 06:20:47 -0700
commit08bb7c6c889594f2a1694c5bdf0f4648be4a8d66 (patch)
tree92c6e423bc00e7aea199c33be1cb1fda299903c9 /lib/std/Thread
parent1493c3b5f3cedff8617380317aba71785ed3f10f (diff)
downloadzig-08bb7c6c889594f2a1694c5bdf0f4648be4a8d66.tar.gz
zig-08bb7c6c889594f2a1694c5bdf0f4648be4a8d66.zip
free freeing wrong amount in thread pool impl
Diffstat (limited to 'lib/std/Thread')
-rw-r--r--lib/std/Thread/Pool.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/std/Thread/Pool.zig b/lib/std/Thread/Pool.zig
index e19166993a..d2b28492c6 100644
--- 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]);
}