Skip to content

Commit

Permalink
core: Fix leak in TLS. #6231
Browse files Browse the repository at this point in the history
  • Loading branch information
brson committed May 15, 2013
1 parent 935b7ba commit 5af8646
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/libcore/task/local_data_priv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,10 @@ unsafe fn get_task_local_map(task: *rust_task) -> TaskLocalMap {
let map_ptr = rt::rust_get_task_local_data(task);
if map_ptr.is_null() {
let map: TaskLocalMap = @mut ~[];
// NB: This bumps the ref count before converting to an unsafe pointer,
// keeping the map alive until TLS is destroyed
rt::rust_set_task_local_data(task, cast::transmute(map));
rt::rust_task_local_data_atexit(task, cleanup_task_local_map_extern_cb);
// Also need to reference it an extra time to keep it for now.
let nonmut = cast::transmute::<TaskLocalMap,
@~[Option<TaskLocalElement>]>(map);
cast::bump_box_refcount(nonmut);
map
} else {
let map = cast::transmute(map_ptr);
Expand Down

5 comments on commit 5af8646

@bors
Copy link
Contributor

@bors bors commented on 5af8646 May 15, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from thestinger
at brson@5af8646

@bors
Copy link
Contributor

@bors bors commented on 5af8646 May 15, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging brson/rust/tls = 5af8646 into auto

@bors
Copy link
Contributor

@bors bors commented on 5af8646 May 15, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

brson/rust/tls = 5af8646 merged ok, testing candidate = bcec83a

@bors
Copy link
Contributor

@bors bors commented on 5af8646 May 15, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 5af8646 May 15, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding incoming to auto = bcec83a

Please sign in to comment.