validate: fix monitor leak when doing frame analysis

The monitor returned by gst_validate_monitor_factory_create() was never
unreffed.
Report instances now have to keep a ref, as suggested by the TODO, as
the reporter is no longer leaked.

Reviewed-by: Thibault Saunier <tsaunier@gnome.org>
Differential Revision: https://phabricator.freedesktop.org/D1012
This commit is contained in:
Guillaume Desmottes 2016-05-24 14:05:37 +00:00 committed by Thibault Saunier
parent 4c6fce855e
commit 15e7f1bbfd
2 changed files with 3 additions and 1 deletions

View file

@ -513,7 +513,7 @@ gst_validate_report_new (GstValidateIssue * issue,
report->refcount = 1;
report->issue = issue;
report->reporter = reporter; /* TODO should we ref? */
report->reporter = g_object_ref (reporter);
report->message = g_strdup (message);
g_mutex_init (&report->shadow_reports_lock);
report->timestamp =
@ -530,6 +530,7 @@ gst_validate_report_unref (GstValidateReport * report)
g_return_if_fail (report != NULL);
if (G_UNLIKELY (g_atomic_int_dec_and_test (&report->refcount))) {
g_object_unref (report->reporter);
g_free (report->message);
g_list_free_full (report->shadow_reports,
(GDestroyNotify) gst_validate_report_unref);

View file

@ -557,6 +557,7 @@ _run_frame_analysis (GstValidateMediaDescriptorWriter * writer,
writer->priv->loop = NULL;
gst_bus_remove_signal_watch (bus);
gst_object_unref (bus);
g_object_unref (monitor);
return TRUE;
}