video: Don't leak the gst::Buffer when converting a VideoFrame into an ffi::GstVideoFrame

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1220>
This commit is contained in:
Sebastian Dröge 2023-02-13 14:29:10 +02:00
parent bc3e1404d6
commit d1cc1b6715

View file

@ -283,7 +283,11 @@ impl<T> VideoFrame<T> {
#[inline]
pub fn into_raw(self) -> ffi::GstVideoFrame {
mem::ManuallyDrop::new(self).frame
unsafe {
let mut s = mem::ManuallyDrop::new(self);
ptr::drop_in_place(&mut s.buffer);
s.frame
}
}
}