We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5588988 commit bd5a965Copy full SHA for bd5a965
RxSwift/Schedulers/CurrentThreadScheduler.swift
@@ -50,7 +50,11 @@ public class CurrentThreadScheduler : ImmediateSchedulerType {
50
51
private static var isScheduleRequiredKey: pthread_key_t = { () -> pthread_key_t in
52
let key = UnsafeMutablePointer<pthread_key_t>.allocate(capacity: 1)
53
- if pthread_key_create(key, nil) != 0 {
+ defer {
54
+ key.deallocate(capacity: 1)
55
+ }
56
+
57
+ guard pthread_key_create(key, nil) == 0 else {
58
rxFatalError("isScheduleRequired key creation failed")
59
}
60
0 commit comments