From 3c9f5e6e5eb0a29f193e0777690e365d13418d3e Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Sun, 23 Feb 2014 01:32:23 +1100 Subject: [PATCH] [886/906] fixup a memory leak of the context in the GLTextureUploadMeta path gst_structure_get returns a reference to the object and we asked for another with gst_object_replace. https://bugzilla.gnome.org/show_bug.cgi?id=724816 --- gst-libs/gst/gl/gstglfilter.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gst-libs/gst/gl/gstglfilter.c b/gst-libs/gst/gl/gstglfilter.c index fdcca09561..5260bccd47 100644 --- a/gst-libs/gst/gl/gstglfilter.c +++ b/gst-libs/gst/gl/gstglfilter.c @@ -867,9 +867,13 @@ gst_gl_filter_decide_allocation (GstBaseTransform * trans, GstQuery * query) gst_query_parse_nth_allocation_meta (query, idx, &upload_meta_params); if (gst_structure_get (upload_meta_params, "gst.gl.GstGLContext", - GST_GL_TYPE_CONTEXT, &context, NULL) && context) - gst_object_replace ((GstObject **) & filter->context, - (GstObject *) context); + GST_GL_TYPE_CONTEXT, &context, NULL) && context) { + GstGLContext *old = filter->context; + + filter->context = context; + if (old) + gst_object_unref (old); + } } if (!filter->context) {