about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-01-22 12:20:29 +0100
committerGitHub <noreply@github.com>2019-01-22 12:20:29 +0100
commit7fb44e860430286e22f9f77b9963ff0f0622d01a (patch)
tree1d4abc56bb3e2f24ae31a292324185b1db07d770
parentad55b73da1e3701cf09c54dc813779adbae39d5b (diff)
parent763392cb8ca09e0f332c1ab9b75376afbdafc18f (diff)
downloadrust-7fb44e860430286e22f9f77b9963ff0f0622d01a.tar.gz
rust-7fb44e860430286e22f9f77b9963ff0f0622d01a.zip
Rollup merge of #57667 - ishitatsuyuki:p-leak, r=nnethercote
Fix memory leak in P::filter_map

Probably this function isn't widely used, but anyway this wasn't working as intended.

r? @eddyb

Do not rollup if you want to see if max-rss change in perf.
-rw-r--r--src/libsyntax/ptr.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libsyntax/ptr.rs b/src/libsyntax/ptr.rs
index bb1744e2df1..3effe53cd29 100644
--- a/src/libsyntax/ptr.rs
+++ b/src/libsyntax/ptr.rs
@@ -101,6 +101,7 @@ impl<T: 'static> P<T> {
                 // Recreate self from the raw pointer.
                 Some(P { ptr: Box::from_raw(p) })
             } else {
+                drop(Box::from_raw(p));
                 None
             }
         }