diff --git a/indexer_ffi/src/indexer.rs b/indexer_ffi/src/indexer.rs index a3991388..c110b183 100644 --- a/indexer_ffi/src/indexer.rs +++ b/indexer_ffi/src/indexer.rs @@ -69,13 +69,18 @@ impl IndexerServiceFFI { // Implement Drop to prevent memory leaks impl Drop for IndexerServiceFFI { fn drop(&mut self) { - if self.indexer_handle.is_null() { + let Self { + indexer_handle, + runtime, + } = self; + + if indexer_handle.is_null() { log::error!("Attempted to drop a null indexer pointer. This is a bug"); } - if self.runtime.is_null() { + if runtime.is_null() { log::error!("Attempted to drop a null tokio runtime pointer. This is a bug"); } - drop(unsafe { Box::from_raw(self.indexer_handle.cast::()) }); - drop(unsafe { Box::from_raw(self.runtime.cast::()) }); + drop(unsafe { Box::from_raw(indexer_handle.cast::()) }); + drop(unsafe { Box::from_raw(runtime.cast::()) }); } }