mirror of
https://github.com/apple/swift-nio
synced 2026-11-24 04:37:54 +00:00
### Motivation: Recently we changed the init and deinit behavior of `ConditionLock`, at that time the `UnsafeMutablePointer` allocation of the held `pthread_cond_t` was put behind a conditional compiler and runtime check. The deallocation of the same object was also put behind a conditional, however the conditions were mismatched leading to a leak on some platforms. Notably this surfaced when `wait`ing on an event loop future. ### Modifications: `ConditionLock.deinit` now deallocs the held `pthread_cond_t` under the same conditions in which it allocs it. ### Result: Creating a `ConditionLock` no longer leaks memory.