glfilter: Only add parent meta if inbuf != outbuf

This was causing a memory leak in cases like `gltestsrc ! gltransformation scale-x=0.5 ! glimagesink`.
Parent meta was being added in assumption that those buffers are different, which was not the case here,
creating a reference loop and never freeing the buffer.

Co-authored-by: Matthew Waters <matthew@centricular.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5453>
This commit is contained in:
Piotr Brzeziński 2023-10-09 14:48:35 +02:00 committed by Tim-Philipp Müller
parent 019430949c
commit b5ca7eba4e

View file

@ -1038,7 +1038,8 @@ gst_gl_filter_transform (GstBaseTransform * bt, GstBuffer * inbuf,
* buffer meta to hold one reference of inbuf, this can avoid this
* buffer sync problem.
*/
gst_buffer_add_parent_buffer_meta (outbuf, inbuf);
if (inbuf != outbuf)
gst_buffer_add_parent_buffer_meta (outbuf, inbuf);
return ret ? GST_FLOW_OK : GST_FLOW_ERROR;
}