Skip to content

Commit

Permalink
[catmem] Bug Fix: Add drop function
Browse files Browse the repository at this point in the history
  • Loading branch information
iyzhang authored and ppenna committed Jun 30, 2023
1 parent 3def8be commit f8aad6c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/rust/catmem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,3 +519,19 @@ impl CatmemLibOS {
self.scheduler.poll()
}
}

//======================================================================================================================
// Trait Implementations
//======================================================================================================================

impl Drop for CatmemLibOS {
// Releases all sockets allocated by Catnap.
fn drop(&mut self) {
for (_, queue) in self.qtable.borrow().get_values() {
if let Err(e) = push_eof(queue.get_pipe().buffer()) {
error!("push_eof() failed: {:?}", e);
warn!("leaking shared memory region");
}
}
}
}

0 comments on commit f8aad6c

Please sign in to comment.