-
Notifications
You must be signed in to change notification settings - Fork 89
Open
Description
signal-hook/src/iterator/exfiltrator/raw.rs
Lines 87 to 94 in 7dfed90
| fn init(&self, slot: &Self::Storage, _: c_int) { | |
| let new = Box::default(); | |
| let old = slot.0.swap(Box::into_raw(new), Ordering::Release); | |
| // We leak the pointer on purpose here. This is invalid state anyway and must not happen, | |
| // but if it still does, we can't drop that while some other thread might still be having | |
| // the raw pointer. | |
| assert!(old.is_null(), "Init called multiple times"); | |
| } |
Noticed that if init is called multiple times, the code will panic.
Probable fix is like:
Use compare_and_exchange and only store the value when the slot.0 is null.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels