-
Notifications
You must be signed in to change notification settings - Fork 126
Open
Description
Looking through the implementation of loom::alloc::Track and rt::Allocation, I was surprised to see that it apparently doesn't alert on a double-free:
Lines 68 to 80 in dbf32b0
| impl Drop for Allocation { | |
| #[track_caller] | |
| fn drop(&mut self) { | |
| let location = location!(); | |
| rt::execution(|execution| { | |
| let state = self.state.get_mut(&mut execution.objects); | |
| trace!(state = ?self.state, drop.location = %location, "Allocation::drop"); | |
| state.is_dropped = true; | |
| }); | |
| } | |
| } |
It looks like if a user is directly calling dealloc(), that would catch a double-free, but with a potentially unhelpful panic message:
Line 45 in dbf32b0
| None => panic!("pointer not tracked"), |
I'm wondering if there's a reason why checking for double-frees was omitted, or if this is just an oversight. It seems like a whole class of possible bugs is being overlooked here.
Metadata
Metadata
Assignees
Labels
No labels