From d7d8fc5652ba8f99a90b8a8e17526f45d13e3f21 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Tue, 31 Mar 2015 13:26:21 +0200 Subject: [PATCH] discoverer: fix GstToc leak when parsing toc messages gst_message_parse_toc() returns a reffed GstToc which is owned by the GstDiscovererInfo. But we have to make sure we unref its previous value before setting the new one. https://bugzilla.gnome.org/show_bug.cgi?id=747103 --- gst-libs/gst/pbutils/gstdiscoverer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/pbutils/gstdiscoverer.c b/gst-libs/gst/pbutils/gstdiscoverer.c index 244b374e07..dd1944f18f 100644 --- a/gst-libs/gst/pbutils/gstdiscoverer.c +++ b/gst-libs/gst/pbutils/gstdiscoverer.c @@ -1423,7 +1423,9 @@ handle_message (GstDiscoverer * dc, GstMessage * msg) gst_message_parse_toc (msg, &tmp, NULL); GST_DEBUG_OBJECT (GST_MESSAGE_SRC (msg), "Got toc %" GST_PTR_FORMAT, tmp); - dc->priv->current_info->toc = tmp; + if (dc->priv->current_info->toc) + gst_toc_unref (dc->priv->current_info->toc); + dc->priv->current_info->toc = tmp; /* transfer ownership */ GST_DEBUG_OBJECT (GST_MESSAGE_SRC (msg), "Current info %p, toc %" GST_PTR_FORMAT, dc->priv->current_info, tmp); }