mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-25 11:01:10 +00:00
basetransform: Don't leak any output buffer if prepare_output_buffer
fails
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1290>
This commit is contained in:
parent
38420c7aab
commit
d77f983b02
1 changed files with 9 additions and 0 deletions
|
@ -570,6 +570,13 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
|||
PrepareOutputBufferSuccess::Buffer(from_glib_full(outbuf))
|
||||
}
|
||||
})
|
||||
.map_err(|err| {
|
||||
if outbuf != buf as *mut _ {
|
||||
drop(Option::<gst::Buffer>::from_glib_full(outbuf));
|
||||
}
|
||||
|
||||
err
|
||||
})
|
||||
})
|
||||
.unwrap_or(Err(gst::FlowError::NotSupported))
|
||||
}
|
||||
|
@ -1140,6 +1147,8 @@ unsafe extern "C" fn base_transform_prepare_output_buffer<T: BaseTransformImpl>(
|
|||
true => InputBuffer::Writable(gst::BufferRef::from_mut_ptr(inbuf)),
|
||||
};
|
||||
|
||||
*outbuf = ptr::null_mut();
|
||||
|
||||
gst::panic_to_error!(imp, gst::FlowReturn::Error, {
|
||||
match imp.prepare_output_buffer(buffer) {
|
||||
Ok(PrepareOutputBufferSuccess::InputBuffer) => {
|
||||
|
|
Loading…
Reference in a new issue