After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 340608 - leaking caps in padtemplate
leaking caps in padtemplate
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal normal
: 0.10.6
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-05-04 10:27 UTC by Stefan Sauer (gstreamer, gtkdoc dev)
Modified: 2006-05-07 19:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
unref the caps (765 bytes, patch)
2006-05-04 10:29 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
none Details | Review

Description Stefan Sauer (gstreamer, gtkdoc dev) 2006-05-04 10:27:02 UTC
gst_static_pad_template_get() seems to leak the caps from the gst_static_caps_get() call.

Out of curiosity wouldn't

gst_caps_make_writable()
be better that gst_caps_copy() and gst_caps_unref() ?

attached patch changes it to:

caps = gst_static_caps_get (&pad_template->static_caps);  
GST_PAD_TEMPLATE_CAPS (new) = gst_caps_copy (caps);  
gst_caps_unref (caps);

would this also work?
 
GST_PAD_TEMPLATE_CAPS (new) = gst_caps_make_writable (
    gst_static_caps_get (&pad_template->static_caps));
Comment 1 Stefan Sauer (gstreamer, gtkdoc dev) 2006-05-04 10:29:47 UTC
Created attachment 64799 [details] [review]
unref the caps
Comment 2 Tim-Philipp Müller 2006-05-04 14:25:57 UTC
Both should work (I think the version in your patch is nicer to read though).

The static caps are leaked in any case though, aren't they? (the question is just what refcount they're gonna have at the end of the day, isn't it?)

Comment 3 Stefan Sauer (gstreamer, gtkdoc dev) 2006-05-07 19:58:14 UTC
the docs to gst_static_caps_get() suggest to use gst_caps_make_writable(), so I switch to this.

2006-05-07  Stefan Kost  <ensonic@users.sf.net>

	* gst/gstpadtemplate.c: (gst_static_pad_template_get):
          use gst_caps_make_writable instead of gst_caps_copy, Fixes #340608