validate: Plug some leaks

And add some valgrind suppression for fontconfig
This commit is contained in:
Thibault Saunier 2020-03-10 11:50:26 -03:00
parent a055c3272e
commit 9b260a1ec6
7 changed files with 73 additions and 11 deletions

View file

@ -201,3 +201,41 @@
fun:_draw_background
fun:gst_gl_video_mixer_callback
}
{
#https://bugs.freedesktop.org/show_bug.cgi?id=8215
#https://bugs.freedesktop.org/show_bug.cgi?id=8428
#FcPattern uses 'intptr_t elts_offset' instead of 'FcPatternEltPtr elts',
#which confuses valgrind.
font_config_bug_2
Memcheck:Leak
fun:*alloc
...
fun:Fc*Add*
}
{
#Same root cause as font_config_bug_2.
#The 'leak' here is a copy of rule values, as opposed to new values.
font_config_bug_3
Memcheck:Leak
fun:*alloc
...
fun:FcConfigValues
}
{
#Same root cause as font_config_bug_2.
#The 'leak' is copies of font or pattern values into returned pattern values.
font_config_bug_4
Memcheck:Leak
fun:*alloc
...
fun:FcValue*
fun:FcFontRenderPrepare
}
{
font_config_bug_6
Memcheck:Leak
fun:*alloc
...
obj:*/libfontconfig.so.*
}

View file

@ -150,7 +150,7 @@ gst_validate_bin_monitor_dispose (GObject * object)
if (monitor->scenario) {
gst_validate_reporter_purge_reports (GST_VALIDATE_REPORTER
(monitor->scenario));
g_object_unref (monitor->scenario);
gst_object_unref (monitor->scenario);
}
g_list_free_full (monitor->element_monitors, purge_and_unref_reporter);

View file

@ -959,7 +959,7 @@ gst_validate_pad_monitor_reset (GstValidatePadMonitor * pad_monitor)
{
gst_validate_pad_monitor_flush (pad_monitor);
/* Note : For the entries that haven't been resetted in _flush(), do
/* Note : For the entries that haven't been reset in _flush(), do
* it here and keep in the same order as the GstValidatePadMonitor
* structure */
@ -1637,11 +1637,17 @@ gst_validate_pad_monitor_add_expected_newsegment (GstValidatePadMonitor *
switch (gst_iterator_next (iter, &value)) {
case GST_ITERATOR_OK:
otherpad = g_value_get_object (&value);
if (!otherpad)
if (!otherpad) {
g_value_reset (&value);
continue;
}
othermonitor = _GET_PAD_MONITOR (otherpad);
if (!othermonitor)
if (!othermonitor) {
g_value_reset (&value);
continue;
}
GST_VALIDATE_MONITOR_LOCK (othermonitor);
gst_event_replace (&othermonitor->expected_segment, event);
GST_VALIDATE_MONITOR_UNLOCK (othermonitor);

View file

@ -775,6 +775,7 @@ gst_validate_pipeline_monitor_create_scenarios (GstValidateBinMonitor * monitor)
GST_INFO_OBJECT (monitor, "Not attaching to pipeline %" GST_PTR_FORMAT
" as not matching pattern %s", target, scenario_v[1]);
g_strfreev (scenario_v);
goto done;
}
}

View file

@ -747,6 +747,7 @@ _report_free (GstValidateReport * report)
g_free (report->message);
g_free (report->reporter_name);
g_free (report->trace);
g_free (report->dotfile_name);
g_list_free_full (report->shadow_reports,
(GDestroyNotify) gst_validate_report_unref);
g_list_free_full (report->repeated_reports,
@ -767,6 +768,7 @@ gst_validate_report_new (GstValidateIssue * issue,
gst_mini_object_init (((GstMiniObject *) report), 0,
_gst_validate_report_type, NULL, NULL,
(GstMiniObjectFreeFunction) _report_free);
GST_MINI_OBJECT_FLAG_SET (report, GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
report->issue = issue;
/* The reporter is owning a ref on the report so it doesn't keep a ref to

View file

@ -541,6 +541,8 @@ _update_well_known_vars (GstValidateScenario * scenario)
} else {
GST_WARNING_OBJECT (scenario, "Could not query position");
}
gst_object_unref (pipeline);
}
static gboolean
@ -2861,6 +2863,7 @@ _execute_appsrc_push (GstValidateScenario * scenario,
gst_validate_action_ref (action);
g_signal_emit_by_name (target, "push-buffer", buffer, &push_buffer_ret);
gst_buffer_unref (buffer);
if (push_buffer_ret != GST_FLOW_OK) {
gchar *structure_string = gst_structure_to_string (action->structure);
GST_VALIDATE_REPORT_ACTION (scenario, action,
@ -3004,6 +3007,7 @@ gst_validate_action_default_prepare_func (GstValidateAction * action)
GstClockTime tmp;
gchar *repeat_expr;
gchar *error = NULL;
GstValidateExecuteActionReturn res = GST_VALIDATE_EXECUTE_ACTION_OK;
GstValidateActionType *type = gst_validate_get_action_type (action->type);
GstValidateScenario *scenario = gst_validate_action_get_scenario (action);
@ -3018,17 +3022,17 @@ gst_validate_action_default_prepare_func (GstValidateAction * action)
}
if (action->repeat > 0)
return GST_VALIDATE_EXECUTE_ACTION_OK;
goto done;
if (!gst_structure_has_field (action->structure, "repeat"))
return GST_VALIDATE_EXECUTE_ACTION_OK;
goto done;
if (gst_structure_get_int (action->structure, "repeat", &action->repeat))
return GST_VALIDATE_EXECUTE_ACTION_OK;
goto done;
if (gst_structure_get_double (action->structure, "repeat",
(gdouble *) & action->repeat))
return GST_VALIDATE_EXECUTE_ACTION_OK;
goto done;
repeat_expr =
g_strdup (gst_structure_get_string (action->structure, "repeat"));
@ -3036,7 +3040,7 @@ gst_validate_action_default_prepare_func (GstValidateAction * action)
g_error ("Invalid value for 'repeat' in %s",
gst_structure_to_string (action->structure));
return GST_VALIDATE_EXECUTE_ACTION_ERROR;
goto err;
}
action->repeat =
@ -3046,7 +3050,7 @@ gst_validate_action_default_prepare_func (GstValidateAction * action)
g_error ("Invalid value for 'repeat' in %s: %s",
gst_structure_to_string (action->structure), error);
return GST_VALIDATE_EXECUTE_ACTION_ERROR;
goto err;
}
g_free (repeat_expr);
@ -3055,10 +3059,14 @@ gst_validate_action_default_prepare_func (GstValidateAction * action)
gst_structure_set (action->priv->main_structure, "repeat", G_TYPE_INT,
action->repeat, NULL);
done:
if (scenario)
gst_object_unref (scenario);
return GST_VALIDATE_EXECUTE_ACTION_OK;
return res;
err:
res = GST_VALIDATE_EXECUTE_ACTION_ERROR;
goto done;
}
static void
@ -3113,6 +3121,7 @@ gst_validate_scenario_check_latency (GstValidateScenario * scenario,
}
gst_query_parse_latency (query, NULL, &min_latency, NULL);
gst_query_unref (query);
GST_DEBUG_OBJECT (scenario, "Pipeline latency: %" GST_TIME_FORMAT
" max allowed: %" GST_TIME_FORMAT,
GST_TIME_ARGS (min_latency), GST_TIME_ARGS (priv->max_latency));
@ -4310,6 +4319,7 @@ check_last_sample_internal (GstValidateScenario * scenario,
}
done:
gst_sample_unref (sample);
return res;
}
@ -4352,6 +4362,8 @@ _check_last_sample_value (GstValidateScenario * scenario,
g_object_get (sink, "last-sample", &sample, NULL);
if (sample == NULL)
return GST_VALIDATE_EXECUTE_ACTION_ASYNC;
gst_sample_unref (sample);
gst_validate_action_unref (action);
g_signal_handlers_disconnect_by_func (sink, sink_last_sample_notify_cb,
action);
@ -4479,10 +4491,12 @@ _execute_check_last_sample (GstValidateScenario * scenario,
goto error;
}
g_clear_object (&pipeline);
return _check_last_sample_value (scenario, action, sink);
error:
g_clear_object (&sink);
g_clear_object (&pipeline);
return GST_VALIDATE_EXECUTE_ACTION_ERROR_REPORTED;
}

View file

@ -223,6 +223,7 @@ validate_flow_override_new (GstStructure * config)
gchar *ignored_fields, *logged_fields;
flow = g_object_new (VALIDATE_TYPE_FLOW_OVERRIDE, NULL);
GST_OBJECT_FLAG_SET (flow, GST_OBJECT_FLAG_MAY_BE_LEAKED);
override = GST_VALIDATE_OVERRIDE (flow);
/* pad: Name of the pad where flowing buffers and events will be monitorized. */