Skip to content

Commit ea8f5fe

Browse files
committed
sync::mpsc: prevent double free on Drop
This PR is fixing a regression introduced by #121646 that can lead to a double free when dropping the channel. The details of the bug can be found in the corresponding crossbeam PR crossbeam-rs/crossbeam#1187 Signed-off-by: Petros Angelatos <[email protected]>
1 parent cf1f614 commit ea8f5fe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tests/pass/issues/issue-139553.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fn main() {
3838
// call returns the channel state has tail.index = head.index, tail.block = NULL, and
3939
// head.block != NULL.
4040
t1.join().unwrap();
41-
// 6. The last sender (s1) is dropped here which also attempts to cleanup any data in the
41+
// 6. The last sender (s2) is dropped here which also attempts to cleanup any data in the
4242
// channel. It observes `tail.index = head.index` and so it doesn't attempt to cleanup any
4343
// messages but it also observes that `head.block != NULL` and attempts to deallocate it.
4444
// This is however already deallocated by `discard_all_messages`, leading to a double free.

0 commit comments

Comments
 (0)