about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorElliott Slaughter <eslaughter@mozilla.com>2012-08-20 10:09:22 -0700
committerElliott Slaughter <eslaughter@mozilla.com>2012-09-07 09:21:21 -0700
commit3405c548e8f65c9955dfc89188f3cd9db4432bba (patch)
tree266fd379c025e80e8697451afd6b9bac361214fc /src
parent9ea4afe5daf359c7022057774f943645d0d32043 (diff)
gc: Avoid freeing null pointers.
Diffstat (limited to 'src')
-rw-r--r--src/libcore/gc.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libcore/gc.rs b/src/libcore/gc.rs
index 066fa0b2e43..697c6fcdfb4 100644
--- a/src/libcore/gc.rs
+++ b/src/libcore/gc.rs
@@ -102,6 +102,12 @@ unsafe fn walk_gc_roots(mem: Memory, visitor: Visitor) {
                 match sp {
                   Some(sp_info) => {
                     for walk_safe_point(frame.fp, sp_info) |root, tydesc| {
+                        // Skip null pointers, which can occur when a
+                        // unique pointer has already been freed.
+                        if ptr::is_null(*root) {
+                            again;
+                        }
+
                         if ptr::is_null(tydesc) {
                             // Root is a generic box.
                             let refcount = **root;