aya: close file descriptors on Map drop.

pull/116/head
Thia Wyrod 3 years ago
parent df393690d3
commit 1584bc47bd
No known key found for this signature in database
GPG Key ID: 55D3AB7E5658CA0C

@ -232,6 +232,15 @@ impl Map {
}
}
impl Drop for Map {
fn drop(&mut self) {
// TODO: Replace this with an OwnedFd once that is stabilized.
if let Some(fd) = self.fd.take() {
unsafe { libc::close(fd) };
}
}
}
pub(crate) trait IterableMap<K: Pod, V> {
fn map(&self) -> &Map;

Loading…
Cancel
Save