Skip to content

Commit 1b37afe

Browse files
committed
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
2 parents 9af93ad + 11c9871 commit 1b37afe

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/libstd/rt/thread.rs

+2
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ mod imp {
245245
let arg: *libc::c_void = cast::transmute(p);
246246
assert_eq!(pthread_create(&mut native, &attr,
247247
super::thread_start, arg), 0);
248+
assert_eq!(pthread_attr_destroy(&mut attr), 0);
248249
native
249250
}
250251

@@ -303,6 +304,7 @@ mod imp {
303304
fn pthread_join(native: libc::pthread_t,
304305
value: **libc::c_void) -> libc::c_int;
305306
fn pthread_attr_init(attr: *mut libc::pthread_attr_t) -> libc::c_int;
307+
fn pthread_attr_destroy(attr: *mut libc::pthread_attr_t) -> libc::c_int;
306308
fn pthread_attr_setstacksize(attr: *mut libc::pthread_attr_t,
307309
stack_size: libc::size_t) -> libc::c_int;
308310
fn pthread_attr_setdetachstate(attr: *mut libc::pthread_attr_t,

0 commit comments

Comments
 (0)