Merge pull request #2607 from ahlinc/fix-zero-deallocs
fix: `dealloc` calls on zero pointers
This commit is contained in:
commit
524bf7e2c6
3 changed files with 18 additions and 7 deletions
|
|
@ -37,6 +37,8 @@ impl<T: Copy> ExactSizeIterator for CBufferIter<T> {}
|
|||
|
||||
impl<T> Drop for CBufferIter<T> {
|
||||
fn drop(&mut self) {
|
||||
unsafe { (FREE_FN)(self.ptr as *mut c_void) };
|
||||
if !self.ptr.is_null() {
|
||||
unsafe { (FREE_FN)(self.ptr as *mut c_void) };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue