summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2015-03-31 11:26:21 (GMT)
committerVincent Penquerc'h <vincent.penquerch@collabora.co.uk>2015-04-17 13:49:01 (GMT)
commitd7d8fc5652ba8f99a90b8a8e17526f45d13e3f21 (patch)
tree5626775d6b703deb6e50250b699f02489a9a501a
parentebf8ea4ed9408006a56f85ec31d0f72e645d7c75 (diff)
downloadgst-plugins-base-d7d8fc5652ba8f99a90b8a8e17526f45d13e3f21.tar.gz
gst-plugins-base-d7d8fc5652ba8f99a90b8a8e17526f45d13e3f21.tar.xz
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
-rw-r--r--gst-libs/gst/pbutils/gstdiscoverer.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gst-libs/gst/pbutils/gstdiscoverer.c b/gst-libs/gst/pbutils/gstdiscoverer.c
index 244b374..dd1944f 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);
}