File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: 21ce41d42d6b86e482ec2e7fe01b3feb74dd4ea4
2
+ refs/heads/master: fe03d827a4910c561507be0802bb5f39a477cc02
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: 54ae2800ffb30513f89ce13d27ac3c8d095d98ac
5
5
refs/heads/try: 71bebebc37fbb229877da88dde13c2f35913bd77
Original file line number Diff line number Diff line change @@ -91,7 +91,17 @@ pub fn read(prompt: &str) -> Option<~str> {
91
91
let line = locked ! ( rustrt:: linenoise( buf) ) ;
92
92
93
93
if line. is_null ( ) { None }
94
- else { Some ( str:: raw:: from_c_str ( line) ) }
94
+ else {
95
+ unsafe {
96
+ do ( || {
97
+ Some ( str:: raw:: from_c_str ( line) )
98
+ } ) . finally {
99
+ // linenoise's return value is from strdup, so we
100
+ // better not leak it.
101
+ rt:: global_heap:: exchange_free ( line) ;
102
+ }
103
+ }
104
+ }
95
105
}
96
106
}
97
107
You can’t perform that action at this time.
0 commit comments