about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-06-09 20:57:55 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-06-09 20:57:55 -0700
commit4fecc503ee6f4fcd97d0d9421bfed279dd67ac6c (patch)
treedda5bc529794c3533350c0a90588fb2ed1598c7b /src
parent0ea7aa30cc864d00fc30b9ba610f2daefab4e850 (diff)
downloadrust-4fecc503ee6f4fcd97d0d9421bfed279dd67ac6c.tar.gz
rust-4fecc503ee6f4fcd97d0d9421bfed279dd67ac6c.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/librustrt/at_exit_imp.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/librustrt/at_exit_imp.rs b/src/librustrt/at_exit_imp.rs
index d38d06950bf..2f1c38c5686 100644
--- a/src/librustrt/at_exit_imp.rs
+++ b/src/librustrt/at_exit_imp.rs
@@ -54,7 +54,8 @@ pub fn run() {
         rtassert!(queue != 0);
 
         let queue: Box<Queue> = mem::transmute(queue);
-        mem::replace(&mut *queue.lock(), Vec::new())
+        let v = mem::replace(&mut *queue.lock(), Vec::new());
+        v
     };
 
     for to_run in cur.move_iter() {