diff --git a/address_space/src/host_mmap.rs b/address_space/src/host_mmap.rs index d31d4fd34f4a37b940e0d53bc07a7b398938998d..46eaf39e55cc39e29093c83d8ba3abb114b7cc60 100644 --- a/address_space/src/host_mmap.rs +++ b/address_space/src/host_mmap.rs @@ -482,10 +482,17 @@ impl Drop for HostMemMapping { /// Release the memory mapping. fn drop(&mut self) { // SAFETY: self.host_addr and self.size has already been verified during initialization. - unsafe { + let ret = unsafe { libc::munmap( self.host_addr as *mut libc::c_void, self.size() as libc::size_t, + ) + }; + + if ret < 0 { + error!( + "Failed to release memory mapping, error: {:?}", + std::io::Error::last_os_error() ); } }