From f0bb4e5bef62f05fc261e55bb64e273f5fffc4a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 13 Feb 2023 14:29:10 +0200 Subject: [PATCH] video: Don't leak the `gst::Buffer` when converting a `VideoFrame` into an `ffi::GstVideoFrame` Part-of: --- gstreamer-video/src/video_frame.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gstreamer-video/src/video_frame.rs b/gstreamer-video/src/video_frame.rs index a65ee9a2b..36aab7da3 100644 --- a/gstreamer-video/src/video_frame.rs +++ b/gstreamer-video/src/video_frame.rs @@ -283,7 +283,11 @@ impl VideoFrame { #[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 + } } }