gsttracerutils: Fix leak in gst_tracer_utils_create_tracer()
Co-authored-by: Alicia Boya García <aboya@igalia.com> Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9028>
This commit is contained in:
parent
4c6a0b655d
commit
98e8d3a127
@ -131,10 +131,11 @@ gst_tracer_utils_create_tracer (GstTracerFactory * factory, const gchar * name,
|
||||
{
|
||||
gchar *available_props = NULL;
|
||||
GObjectClass *gobject_class = g_type_class_ref (factory->type);
|
||||
GstTracer *tracer;
|
||||
GstTracer *tracer = NULL;
|
||||
const gchar **names = NULL;
|
||||
GValue *values = NULL;
|
||||
gint n_properties = 1;
|
||||
GstStructure *structure = NULL;
|
||||
|
||||
if (gst_tracer_class_uses_structure_params (GST_TRACER_CLASS (gobject_class))) {
|
||||
GST_DEBUG ("Use structure parameters for %s", params);
|
||||
@ -145,7 +146,7 @@ gst_tracer_utils_create_tracer (GstTracerFactory * factory, const gchar * name,
|
||||
}
|
||||
|
||||
gchar *struct_str = g_strdup_printf ("%s,%s", name, params);
|
||||
GstStructure *structure = gst_structure_from_string (struct_str, NULL);
|
||||
structure = gst_structure_from_string (struct_str, NULL);
|
||||
g_free (struct_str);
|
||||
|
||||
if (!structure) {
|
||||
@ -199,8 +200,6 @@ gst_tracer_utils_create_tracer (GstTracerFactory * factory, const gchar * name,
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
g_type_class_unref (gobject_class);
|
||||
} else {
|
||||
names = g_new0 (const gchar *, n_properties);
|
||||
names[0] = (const gchar *) "params";
|
||||
@ -216,20 +215,32 @@ create:
|
||||
GST_TRACER (g_object_new_with_properties (factory->type,
|
||||
n_properties, names, values));
|
||||
|
||||
for (gint j = 0; j < n_properties; j++) {
|
||||
g_value_unset (&values[j]);
|
||||
done:
|
||||
g_free (available_props);
|
||||
|
||||
if (structure)
|
||||
gst_structure_free (structure);
|
||||
|
||||
if (values) {
|
||||
for (gint j = 0; j < n_properties; j++) {
|
||||
if (G_VALUE_TYPE (&values[j]) != G_TYPE_INVALID)
|
||||
g_value_unset (&values[j]);
|
||||
}
|
||||
}
|
||||
|
||||
g_free (names);
|
||||
g_free (values);
|
||||
|
||||
/* Clear floating flag */
|
||||
gst_object_ref_sink (tracer);
|
||||
if (tracer) {
|
||||
/* Clear floating flag */
|
||||
gst_object_ref_sink (tracer);
|
||||
|
||||
/* tracers register them self to the hooks */
|
||||
gst_object_unref (tracer);
|
||||
/* tracers register them self to the hooks */
|
||||
gst_object_unref (tracer);
|
||||
|
||||
done:
|
||||
g_free (available_props);
|
||||
}
|
||||
|
||||
g_type_class_unref (gobject_class);
|
||||
}
|
||||
|
||||
/* Initialize the tracing system */
|
||||
|
Loading…
x
Reference in New Issue
Block a user