[Bug 691698] Memory corruption: gst_pad_get_pad_template_caps returns a reference on GST_CAPS_ANY

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Mon Jan 14 03:21:56 PST 2013


https://bugzilla.gnome.org/show_bug.cgi?id=691698
  GStreamer | gstreamer (core) | 1.0.5

--- Comment #4 from Sebastian Dröge <slomo at circular-chaos.org> 2013-01-14 11:21:54 UTC ---
(In reply to comment #3)
> Thanks for your answer Sebastian. I agree with you but is there no risk to do
> like it's done right now because if several threads tried to ref or unref
> GST_CAPS_ANY that might lead to memory corruption. No?

No, gst_caps_ref() and all the ref()/unref() functions are threadsafe

> Actually, the issue was coming from my own local code where GST_CAPS_ANY was
> used without referencing it and later on unref...

GST_CAPS_ANY is unowned by the caller, you either have to call ref() on it or
not call unref() on it later. You must call ref() on it if you intent to change
it.

> By the way, I would expect from elements to always have a padtemplate on their
> sink and src pads. In the description of input-selector there is a padtemplate
> for each sink and src pads but when asking for its src pad template caps with
> gst_pad_get_pad_template_caps () we can see there is no one and the function
> returns a new reference of GST_CAPS_ANY. I didn't check the code of
> input-selector but I'm wondering if it's normal.

Yes, input-selector accepts ANY caps.

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list