diff options
author | Matthew Waters <ystreet00@gmail.com> | 2014-02-23 01:32:23 +1100 |
---|---|---|
committer | Matthew Waters <ystreet00@gmail.com> | 2014-02-23 01:38:11 +1100 |
commit | 7ab354d645251d1a51c967979c4a8f8bfdbdd93f (patch) | |
tree | e56c4b7b7ed6b68a7825493e390fee4e4084ebbe | |
parent | 41de8900b8323696d0b434096d56eab0321d2256 (diff) |
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
-rw-r--r-- | gst-libs/gst/gl/gstglfilter.c | 10 | ||||
-rw-r--r-- | gst/gl/gstgltestsrc.c | 9 |
2 files changed, 14 insertions, 5 deletions
diff --git a/gst-libs/gst/gl/gstglfilter.c b/gst-libs/gst/gl/gstglfilter.c index fdcca09..5260bcc 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) { diff --git a/gst/gl/gstgltestsrc.c b/gst/gl/gstgltestsrc.c index c7ff3b1..1d9d343 100644 --- a/gst/gl/gstgltestsrc.c +++ b/gst/gl/gstgltestsrc.c @@ -624,8 +624,13 @@ gst_gl_test_src_decide_allocation (GstBaseSrc * basesrc, 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 **) & src->context, (GstObject *) context); + GST_GL_TYPE_CONTEXT, &context, NULL) && context) { + GstGLContext *old = src->context; + + src->context = context; + if (old) + gst_object_unref (old); + } } if (!src->context) { |