Skip to content

Commit 4fecc50

Browse files
committed
rustrt: Fix invalid reads caught by valgrind
This is another case of #13246. The RAII lock wasn't being destroyed until after the allocation was free'd due to destructor scheduling. Closes #14784
1 parent 0ea7aa3 commit 4fecc50

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/librustrt/at_exit_imp.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ pub fn run() {
5454
rtassert!(queue != 0);
5555

5656
let queue: Box<Queue> = mem::transmute(queue);
57-
mem::replace(&mut *queue.lock(), Vec::new())
57+
let v = mem::replace(&mut *queue.lock(), Vec::new());
58+
v
5859
};
5960

6061
for to_run in cur.move_iter() {

0 commit comments

Comments
 (0)