[544/906] fix memory leaks from not g_free()ing string returned by gst_element_get_name

This commit is contained in:
Matthew Waters 2012-07-13 01:04:22 +10:00 committed by Tim-Philipp Müller
parent 7a79d684e2
commit 56bf6e2fb3
2 changed files with 17 additions and 8 deletions

View file

@ -187,10 +187,12 @@ gst_gl_filter_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
gst_structure_set (structure, "gstgldisplay", G_TYPE_POINTER,
filter->display, NULL);
} else {
gchar *name;
/* at least one gl element is after in our gl chain */
res =
g_strcmp0 (gst_element_get_name (parent),
gst_structure_get_name (structure)) == 0;
name = gst_element_get_name (parent);
res = g_strcmp0 (name, gst_structure_get_name (structure)) == 0;
g_free (name);
}
if (!res)
res = gst_pad_query_default (pad, parent, query);
@ -240,6 +242,7 @@ gst_gl_filter_start (GstBaseTransform * bt)
GstStructure *structure = NULL;
GstQuery *query = NULL;
gboolean isPerformed = FALSE;
gchar *name;
if (!parent) {
GST_ELEMENT_ERROR (filter, CORE, STATE_CHANGE, (NULL),
@ -247,8 +250,10 @@ gst_gl_filter_start (GstBaseTransform * bt)
return FALSE;
}
structure = gst_structure_new_empty (gst_element_get_name (filter));
name = gst_element_get_name (filter);
structure = gst_structure_new_empty (name);
query = gst_query_new_custom (GST_QUERY_CUSTOM, structure);
g_free (name);
isPerformed = gst_element_query (parent, query);

View file

@ -215,6 +215,7 @@ gst_gl_mixer_update_src_caps (GstGLMixer * mix)
gst_structure_get_int (s, "width", &info.width);
gst_structure_get_int (s, "height", &info.height);
gst_structure_get_fraction (s, "fraction", &info.fps_n, &info.fps_d);
gst_caps_unref (caps);
}
caps = gst_video_info_to_caps (&info);
@ -893,10 +894,10 @@ gst_gl_mixer_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
* comes from src pad with every display of the sink pads */
GSList *walk = mix->sinkpads;
GstStructure *structure = gst_query_writable_structure (query);
gchar *name = gst_element_get_name (mix);
res =
g_strcmp0 (gst_element_get_name (mix),
gst_structure_get_name (structure)) == 0;
res = g_strcmp0 (name, gst_structure_get_name (structure)) == 0;
g_free (name);
if (!res) {
GstGLDisplay *foreign_display = NULL;
@ -1966,6 +1967,7 @@ gst_gl_mixer_change_state (GstElement * element, GstStateChange transition)
{
GSList *walk = mix->sinkpads;
gint i = 0;
gchar *name;
GstElement *parent = GST_ELEMENT (gst_element_get_parent (mix));
GstStructure *structure = NULL;
@ -1978,7 +1980,9 @@ gst_gl_mixer_change_state (GstElement * element, GstStateChange transition)
return FALSE;
}
structure = gst_structure_new_empty (gst_element_get_name (mix));
name = gst_element_get_name (mix);
structure = gst_structure_new_empty (name);
g_free (name);
query = gst_query_new_custom (GST_QUERY_CUSTOM, structure);
/* retrieve the gldisplay that is owned by gl elements after the gl mixer */