core/refs: fix leak
[nihav.git] / nihav-core / src / refs.rs
index 023a2136ad99fdafebe5d653957eb372e2f22cae..4c2e2903a0f3e11b4a02a093f93d158398ff6656 100644 (file)
@@ -83,7 +83,8 @@ impl<T> Drop for NABufferRef<T> {
     fn drop(&mut self) {
         unsafe {
             if NABufferData::dec_refs(self.ptr.as_mut().unwrap()) {
-                std::ptr::drop_in_place(self.ptr);
+                let data = Box::from_raw(self.ptr);
+                std::mem::drop(data);
             }
         }
     }