mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-12 09:15:29 +00:00
[544/906] fix memory leaks from not g_free()ing string returned by gst_element_get_name
This commit is contained in:
parent
972cd421c7
commit
3affb44884
5 changed files with 44 additions and 22 deletions
|
@ -620,9 +620,11 @@ gst_visual_gl_src_query (GstPad * pad, GstQuery * query)
|
||||||
case GST_QUERY_CUSTOM:
|
case GST_QUERY_CUSTOM:
|
||||||
{
|
{
|
||||||
GstStructure *structure = gst_query_get_structure (query);
|
GstStructure *structure = gst_query_get_structure (query);
|
||||||
res =
|
gchar *name = gst_element_get_name (visual);
|
||||||
g_strcmp0 (gst_element_get_name (visual),
|
|
||||||
gst_structure_get_name (structure)) == 0;
|
res = g_strcmp0 (name, gst_structure_get_name (structure)) == 0;
|
||||||
|
g_free (name);
|
||||||
|
|
||||||
if (!res)
|
if (!res)
|
||||||
res = gst_pad_query_default (pad, query);
|
res = gst_pad_query_default (pad, query);
|
||||||
break;
|
break;
|
||||||
|
@ -746,6 +748,7 @@ render_frame (GstVisualGL * visual)
|
||||||
VisBuffer *lbuf, *rbuf;
|
VisBuffer *lbuf, *rbuf;
|
||||||
guint16 ldata[VISUAL_SAMPLES], rdata[VISUAL_SAMPLES];
|
guint16 ldata[VISUAL_SAMPLES], rdata[VISUAL_SAMPLES];
|
||||||
guint i;
|
guint i;
|
||||||
|
gcahr *name;
|
||||||
|
|
||||||
/* Read VISUAL_SAMPLES samples per channel */
|
/* Read VISUAL_SAMPLES samples per channel */
|
||||||
data =
|
data =
|
||||||
|
@ -798,10 +801,11 @@ render_frame (GstVisualGL * visual)
|
||||||
* Indeed libprojectM has to unbind it before the first rendering pass
|
* Indeed libprojectM has to unbind it before the first rendering pass
|
||||||
* and then rebind it before the final pass. It's done from 2.0.1
|
* and then rebind it before the final pass. It's done from 2.0.1
|
||||||
*/
|
*/
|
||||||
if (g_ascii_strncasecmp (gst_element_get_name (GST_ELEMENT (visual)),
|
name = gst_element_get_name (GST_ELEMENT (visual));
|
||||||
"visualglprojectm", 16) == 0
|
if (g_ascii_strncasecmp (name, "visualglprojectm", 16) == 0
|
||||||
&& !HAVE_PROJECTM_TAKING_CARE_OF_EXTERNAL_FBO)
|
&& !HAVE_PROJECTM_TAKING_CARE_OF_EXTERNAL_FBO)
|
||||||
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0);
|
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0);
|
||||||
|
g_free (name);
|
||||||
|
|
||||||
actor_negotiate (visual->display, visual);
|
actor_negotiate (visual->display, visual);
|
||||||
|
|
||||||
|
@ -1012,6 +1016,7 @@ gst_visual_gl_change_state (GstElement * element, GstStateChange transition)
|
||||||
GstStructure *structure = NULL;
|
GstStructure *structure = NULL;
|
||||||
GstQuery *query = NULL;
|
GstQuery *query = NULL;
|
||||||
gboolean isPerformed = FALSE;
|
gboolean isPerformed = FALSE;
|
||||||
|
gchar *name;
|
||||||
|
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
GST_ELEMENT_ERROR (visual, CORE, STATE_CHANGE, (NULL),
|
GST_ELEMENT_ERROR (visual, CORE, STATE_CHANGE, (NULL),
|
||||||
|
@ -1019,8 +1024,10 @@ gst_visual_gl_change_state (GstElement * element, GstStateChange transition)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
structure = gst_structure_new (gst_element_get_name (visual), NULL);
|
name = gst_element_get_name (visual);
|
||||||
|
structure = gst_structure_new (name, NULL);
|
||||||
query = gst_query_new_application (GST_QUERY_CUSTOM, structure);
|
query = gst_query_new_application (GST_QUERY_CUSTOM, structure);
|
||||||
|
g_free (name);
|
||||||
|
|
||||||
isPerformed = gst_element_query (parent, query);
|
isPerformed = gst_element_query (parent, query);
|
||||||
|
|
||||||
|
|
|
@ -187,10 +187,12 @@ gst_gl_filter_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
||||||
gst_structure_set (structure, "gstgldisplay", G_TYPE_POINTER,
|
gst_structure_set (structure, "gstgldisplay", G_TYPE_POINTER,
|
||||||
filter->display, NULL);
|
filter->display, NULL);
|
||||||
} else {
|
} else {
|
||||||
|
gchar *name;
|
||||||
/* at least one gl element is after in our gl chain */
|
/* at least one gl element is after in our gl chain */
|
||||||
res =
|
|
||||||
g_strcmp0 (gst_element_get_name (parent),
|
name = gst_element_get_name (parent);
|
||||||
gst_structure_get_name (structure)) == 0;
|
res = g_strcmp0 (name, gst_structure_get_name (structure)) == 0;
|
||||||
|
g_free (name);
|
||||||
}
|
}
|
||||||
if (!res)
|
if (!res)
|
||||||
res = gst_pad_query_default (pad, parent, query);
|
res = gst_pad_query_default (pad, parent, query);
|
||||||
|
@ -240,6 +242,7 @@ gst_gl_filter_start (GstBaseTransform * bt)
|
||||||
GstStructure *structure = NULL;
|
GstStructure *structure = NULL;
|
||||||
GstQuery *query = NULL;
|
GstQuery *query = NULL;
|
||||||
gboolean isPerformed = FALSE;
|
gboolean isPerformed = FALSE;
|
||||||
|
gchar *name;
|
||||||
|
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
GST_ELEMENT_ERROR (filter, CORE, STATE_CHANGE, (NULL),
|
GST_ELEMENT_ERROR (filter, CORE, STATE_CHANGE, (NULL),
|
||||||
|
@ -247,8 +250,10 @@ gst_gl_filter_start (GstBaseTransform * bt)
|
||||||
return FALSE;
|
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);
|
query = gst_query_new_custom (GST_QUERY_CUSTOM, structure);
|
||||||
|
g_free (name);
|
||||||
|
|
||||||
isPerformed = gst_element_query (parent, query);
|
isPerformed = gst_element_query (parent, query);
|
||||||
|
|
||||||
|
|
|
@ -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, "width", &info.width);
|
||||||
gst_structure_get_int (s, "height", &info.height);
|
gst_structure_get_int (s, "height", &info.height);
|
||||||
gst_structure_get_fraction (s, "fraction", &info.fps_n, &info.fps_d);
|
gst_structure_get_fraction (s, "fraction", &info.fps_n, &info.fps_d);
|
||||||
|
gst_caps_unref (caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
caps = gst_video_info_to_caps (&info);
|
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 */
|
* comes from src pad with every display of the sink pads */
|
||||||
GSList *walk = mix->sinkpads;
|
GSList *walk = mix->sinkpads;
|
||||||
GstStructure *structure = gst_query_writable_structure (query);
|
GstStructure *structure = gst_query_writable_structure (query);
|
||||||
|
gchar *name = gst_element_get_name (mix);
|
||||||
|
|
||||||
res =
|
res = g_strcmp0 (name, gst_structure_get_name (structure)) == 0;
|
||||||
g_strcmp0 (gst_element_get_name (mix),
|
g_free (name);
|
||||||
gst_structure_get_name (structure)) == 0;
|
|
||||||
|
|
||||||
if (!res) {
|
if (!res) {
|
||||||
GstGLDisplay *foreign_display = NULL;
|
GstGLDisplay *foreign_display = NULL;
|
||||||
|
@ -1966,6 +1967,7 @@ gst_gl_mixer_change_state (GstElement * element, GstStateChange transition)
|
||||||
{
|
{
|
||||||
GSList *walk = mix->sinkpads;
|
GSList *walk = mix->sinkpads;
|
||||||
gint i = 0;
|
gint i = 0;
|
||||||
|
gchar *name;
|
||||||
|
|
||||||
GstElement *parent = GST_ELEMENT (gst_element_get_parent (mix));
|
GstElement *parent = GST_ELEMENT (gst_element_get_parent (mix));
|
||||||
GstStructure *structure = NULL;
|
GstStructure *structure = NULL;
|
||||||
|
@ -1978,7 +1980,9 @@ gst_gl_mixer_change_state (GstElement * element, GstStateChange transition)
|
||||||
return FALSE;
|
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);
|
query = gst_query_new_custom (GST_QUERY_CUSTOM, structure);
|
||||||
|
|
||||||
/* retrieve the gldisplay that is owned by gl elements after the gl mixer */
|
/* retrieve the gldisplay that is owned by gl elements after the gl mixer */
|
||||||
|
|
|
@ -318,9 +318,9 @@ gst_gl_test_src_src_query (GstPad * pad, GstObject * object, GstQuery * query)
|
||||||
case GST_QUERY_CUSTOM:
|
case GST_QUERY_CUSTOM:
|
||||||
{
|
{
|
||||||
const GstStructure *structure = gst_query_get_structure (query);
|
const GstStructure *structure = gst_query_get_structure (query);
|
||||||
res =
|
gchar *name = gst_element_get_name (object);
|
||||||
g_strcmp0 (gst_element_get_name (object),
|
res = g_strcmp0 (name, gst_structure_get_name (structure)) == 0;
|
||||||
gst_structure_get_name (structure)) == 0;
|
g_free (name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -536,6 +536,7 @@ gst_gl_test_src_start (GstBaseSrc * basesrc)
|
||||||
GstStructure *structure = NULL;
|
GstStructure *structure = NULL;
|
||||||
GstQuery *query = NULL;
|
GstQuery *query = NULL;
|
||||||
gboolean isPerformed = FALSE;
|
gboolean isPerformed = FALSE;
|
||||||
|
gchar *name;
|
||||||
|
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
GST_ELEMENT_ERROR (src, CORE, STATE_CHANGE, (NULL),
|
GST_ELEMENT_ERROR (src, CORE, STATE_CHANGE, (NULL),
|
||||||
|
@ -543,8 +544,10 @@ gst_gl_test_src_start (GstBaseSrc * basesrc)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
structure = gst_structure_new_empty (gst_element_get_name (src));
|
name = gst_element_get_name (src);
|
||||||
|
structure = gst_structure_new_empty (name);
|
||||||
query = gst_query_new_custom (GST_QUERY_CUSTOM, structure);
|
query = gst_query_new_custom (GST_QUERY_CUSTOM, structure);
|
||||||
|
g_free (name);
|
||||||
|
|
||||||
isPerformed = gst_element_query (parent, query);
|
isPerformed = gst_element_query (parent, query);
|
||||||
|
|
||||||
|
|
|
@ -225,9 +225,9 @@ gst_gl_upload_src_query (GstPad * pad, GstObject * object, GstQuery * query)
|
||||||
case GST_QUERY_CUSTOM:
|
case GST_QUERY_CUSTOM:
|
||||||
{
|
{
|
||||||
const GstStructure *structure = gst_query_get_structure (query);
|
const GstStructure *structure = gst_query_get_structure (query);
|
||||||
res =
|
gchar *name = gst_element_get_name (object);
|
||||||
g_strcmp0 (gst_element_get_name (object),
|
res = g_strcmp0 (name, gst_structure_get_name (structure)) == 0;
|
||||||
gst_structure_get_name (structure)) == 0;
|
g_free (name);
|
||||||
if (!res)
|
if (!res)
|
||||||
res = gst_pad_query_default (pad, object, query);
|
res = gst_pad_query_default (pad, object, query);
|
||||||
break;
|
break;
|
||||||
|
@ -258,6 +258,7 @@ gst_gl_upload_start (GstBaseTransform * bt)
|
||||||
GstStructure *structure = NULL;
|
GstStructure *structure = NULL;
|
||||||
GstQuery *query = NULL;
|
GstQuery *query = NULL;
|
||||||
gboolean isPerformed = FALSE;
|
gboolean isPerformed = FALSE;
|
||||||
|
gchar *name;
|
||||||
|
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
GST_ELEMENT_ERROR (upload, CORE, STATE_CHANGE, (NULL),
|
GST_ELEMENT_ERROR (upload, CORE, STATE_CHANGE, (NULL),
|
||||||
|
@ -265,8 +266,10 @@ gst_gl_upload_start (GstBaseTransform * bt)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
structure = gst_structure_new_empty (gst_element_get_name (upload));
|
name = gst_element_get_name (upload);
|
||||||
|
structure = gst_structure_new_empty (name);
|
||||||
query = gst_query_new_custom (GST_QUERY_CUSTOM, structure);
|
query = gst_query_new_custom (GST_QUERY_CUSTOM, structure);
|
||||||
|
g_free (name);
|
||||||
|
|
||||||
isPerformed = gst_element_query (parent, query);
|
isPerformed = gst_element_query (parent, query);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue