From 71d7ce19d64e15f364d9908e5e34f0409395054c Mon Sep 17 00:00:00 2001 From: William Casarin Date: Sat, 30 Dec 2023 21:22:42 -0800 Subject: [PATCH] blocks: make sure we drop sometimes we can have owned blocks returned from ndb.get_blocks_by_key --- src/block.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/block.rs b/src/block.rs index 2c6ecf6..9635980 100644 --- a/src/block.rs +++ b/src/block.rs @@ -105,6 +105,12 @@ impl<'a> Blocks<'a> { } } +impl<'a> Drop for Blocks<'a> { + fn drop(&mut self) { + unsafe { bindings::ndb_blocks_free(self.as_ptr()) }; + } +} + impl<'a> BlockIter<'a> { pub(crate) fn new_transactional( content: *const ::std::os::raw::c_char,