about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-04-11 02:21:36 -0700
committerbors <bors@rust-lang.org>2014-04-11 02:21:36 -0700
commit1b37afe8a2ab285ec1b15f5dbb072d005a8a4944 (patch)
tree45226ecf018f250405c57c08440e27d3ee03783a /src
parent9af93ad54ddf2ac7a04d5ea0c07ad362537e8126 (diff)
parent11c9871bcc34f5f0ed3ba92a1cc5629b9ffe422e (diff)
downloadrust-1b37afe8a2ab285ec1b15f5dbb072d005a8a4944.tar.gz
rust-1b37afe8a2ab285ec1b15f5dbb072d005a8a4944.zip
auto merge of #13457 : alexcrichton/rust/issue-13420, r=thestinger
On some OSes (such as freebsd), pthread_attr_init allocates memory, so this is
necessary to deallocate that memory.

Closes #13420
Diffstat (limited to 'src')
-rw-r--r--src/libstd/rt/thread.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libstd/rt/thread.rs b/src/libstd/rt/thread.rs
index b1c7c5aab02..4aa85bc4c72 100644
--- a/src/libstd/rt/thread.rs
+++ b/src/libstd/rt/thread.rs
@@ -245,6 +245,7 @@ mod imp {
         let arg: *libc::c_void = cast::transmute(p);
         assert_eq!(pthread_create(&mut native, &attr,
                                   super::thread_start, arg), 0);
+        assert_eq!(pthread_attr_destroy(&mut attr), 0);
         native
     }
 
@@ -303,6 +304,7 @@ mod imp {
         fn pthread_join(native: libc::pthread_t,
                         value: **libc::c_void) -> libc::c_int;
         fn pthread_attr_init(attr: *mut libc::pthread_attr_t) -> libc::c_int;
+        fn pthread_attr_destroy(attr: *mut libc::pthread_attr_t) -> libc::c_int;
         fn pthread_attr_setstacksize(attr: *mut libc::pthread_attr_t,
                                      stack_size: libc::size_t) -> libc::c_int;
         fn pthread_attr_setdetachstate(attr: *mut libc::pthread_attr_t,