diff --git a/src/compaction_filter.rs b/src/compaction_filter.rs index 2680408..f067156 100644 --- a/src/compaction_filter.rs +++ b/src/compaction_filter.rs @@ -100,7 +100,7 @@ pub unsafe extern "C" fn destructor_callback(raw_cb: *mut c_void) where F: CompactionFilter, { - Box::from_raw(raw_cb as *mut F); + drop(Box::from_raw(raw_cb as *mut F)); } pub unsafe extern "C" fn name_callback(raw_cb: *mut c_void) -> *const c_char diff --git a/src/compaction_filter_factory.rs b/src/compaction_filter_factory.rs index 5b144d0..5895cdb 100644 --- a/src/compaction_filter_factory.rs +++ b/src/compaction_filter_factory.rs @@ -30,7 +30,7 @@ pub unsafe extern "C" fn destructor_callback(raw_self: *mut c_void) where F: CompactionFilterFactory, { - Box::from_raw(raw_self as *mut F); + drop(Box::from_raw(raw_self as *mut F)); } pub unsafe extern "C" fn name_callback(raw_self: *mut c_void) -> *const c_char diff --git a/src/comparator.rs b/src/comparator.rs index 330a95f..c8aba9c 100644 --- a/src/comparator.rs +++ b/src/comparator.rs @@ -26,7 +26,7 @@ pub struct ComparatorCallback { } pub unsafe extern "C" fn destructor_callback(raw_cb: *mut c_void) { - Box::from_raw(raw_cb as *mut ComparatorCallback); + drop(Box::from_raw(raw_cb as *mut ComparatorCallback)); } pub unsafe extern "C" fn name_callback(raw_cb: *mut c_void) -> *const c_char { diff --git a/src/merge_operator.rs b/src/merge_operator.rs index 8cdbed1..e0d8ba7 100644 --- a/src/merge_operator.rs +++ b/src/merge_operator.rs @@ -77,7 +77,7 @@ pub struct MergeOperatorCallback { } pub unsafe extern "C" fn destructor_callback(raw_cb: *mut c_void) { - Box::from_raw(raw_cb as *mut MergeOperatorCallback); + drop(Box::from_raw(raw_cb as *mut MergeOperatorCallback)); } pub unsafe extern "C" fn delete_callback( @@ -86,10 +86,10 @@ pub unsafe extern "C" fn delete_callback( value_length: size_t, ) { if !value.is_null() { - Box::from_raw(slice::from_raw_parts_mut( + drop(Box::from_raw(slice::from_raw_parts_mut( value as *mut u8, value_length as usize, - )); + ))); } } diff --git a/src/slice_transform.rs b/src/slice_transform.rs index 78a7fff..7f7d171 100644 --- a/src/slice_transform.rs +++ b/src/slice_transform.rs @@ -83,7 +83,7 @@ pub struct TransformCallback<'a> { } pub unsafe extern "C" fn slice_transform_destructor_callback(raw_cb: *mut c_void) { - Box::from_raw(raw_cb as *mut TransformCallback); + drop(Box::from_raw(raw_cb as *mut TransformCallback)); } pub unsafe extern "C" fn slice_transform_name_callback(raw_cb: *mut c_void) -> *const c_char { diff --git a/src/write_batch.rs b/src/write_batch.rs index c9cd329..683e457 100644 --- a/src/write_batch.rs +++ b/src/write_batch.rs @@ -122,7 +122,7 @@ impl WriteBatchWithTransaction { ); // we must manually set the raw box free since there is no // associated "destroy" callback for this object - Box::from_raw(state); + drop(Box::from_raw(state)); } }