GstStaticPadTemplate *templ = item->data;
GstCaps *caps = (GstCaps *) & (templ->static_caps);
- g_free ((gchar *) templ->static_caps.string);
-
/* FIXME: this is not threadsafe */
if (caps->refcount == 1) {
GstStructure *structure;
for (item = klass->padtemplates; item; item = item->next) {
GstPadTemplate *templ = item->data;
GstStaticPadTemplate *newt;
+ gchar *caps_string = gst_caps_to_string (templ->caps);
newt = g_slice_new (GstStaticPadTemplate);
newt->name_template = g_intern_string (templ->name_template);
newt->direction = templ->direction;
newt->presence = templ->presence;
newt->static_caps.caps.refcount = 0;
- newt->static_caps.string = gst_caps_to_string (templ->caps);
+ newt->static_caps.string = g_intern_string (caps_string);
factory->staticpadtemplates =
g_list_append (factory->staticpadtemplates, newt);
+
+ g_free (caps_string);
}
factory->numpadtemplates = klass->numpadtemplates;
/* unpack pad template strings */
unpack_const_string (*in, template->name_template, end, fail);
- unpack_string (*in, template->static_caps.string, end, fail);
+ unpack_const_string (*in, template->static_caps.string, end, fail);
__gst_element_factory_add_static_pad_template (factory, template);
GST_DEBUG ("Added pad_template %s", template->name_template);