Skip to content

Commit f0273b6

Browse files
committed
fixed iscache memory leak (whoops)
1 parent ea140c8 commit f0273b6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/image/iscache.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ use libipt_sys::{
1616
pt_iscache_alloc,
1717
pt_iscache_name,
1818
pt_iscache_read,
19-
pt_iscache_set_limit
19+
pt_iscache_set_limit,
20+
pt_iscache_free
2021
};
2122

2223
#[cfg(test)]
@@ -165,4 +166,10 @@ impl<'a> SectionCache<'a> {
165166
pub fn set_limit(&mut self, limit: u64) -> Result<(), PtError> {
166167
ensure_ptok(unsafe { pt_iscache_set_limit(self.0, limit) })
167168
}
169+
}
170+
171+
impl<'a> Drop for SectionCache<'a> {
172+
fn drop(&mut self) {
173+
unsafe { pt_iscache_free(self.0) }
174+
}
168175
}

0 commit comments

Comments
 (0)