From b5ca7eba4e3f244074128baceeb8b4c9355907e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Brzezi=C5=84ski?= Date: Mon, 9 Oct 2023 14:48:35 +0200 Subject: [PATCH] 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 Part-of: --- subprojects/gst-plugins-base/gst-libs/gst/gl/gstglfilter.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subprojects/gst-plugins-base/gst-libs/gst/gl/gstglfilter.c b/subprojects/gst-plugins-base/gst-libs/gst/gl/gstglfilter.c index 54bb0507fe..895d77a27f 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/gl/gstglfilter.c +++ b/subprojects/gst-plugins-base/gst-libs/gst/gl/gstglfilter.c @@ -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; }