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/1219>
This commit is contained in:
Sebastian Dröge 2023-02-13 14:29:10 +02:00
parent 6ffb1db482
commit f0bb4e5bef

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
}
}
}