From 15e7f1bbfd84ce2cc5e6420fee2255c2be95e0f6 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Tue, 24 May 2016 14:05:37 +0000 Subject: [PATCH] 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 Differential Revision: https://phabricator.freedesktop.org/D1012 --- validate/gst/validate/gst-validate-report.c | 3 ++- validate/gst/validate/media-descriptor-writer.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/validate/gst/validate/gst-validate-report.c b/validate/gst/validate/gst-validate-report.c index 1053341b49..16277b8d3b 100644 --- a/validate/gst/validate/gst-validate-report.c +++ b/validate/gst/validate/gst-validate-report.c @@ -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); diff --git a/validate/gst/validate/media-descriptor-writer.c b/validate/gst/validate/media-descriptor-writer.c index 4943bc70e7..7fa446978d 100644 --- a/validate/gst/validate/media-descriptor-writer.c +++ b/validate/gst/validate/media-descriptor-writer.c @@ -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; }