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/5445>
This commit is contained in:
Piotr Brzeziński 2023-10-09 14:48:35 +02:00 committed by GStreamer Marge Bot
parent 3536b7f3a6
commit 64a58c37ac

View file

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