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
This commit is contained in:
Guillaume Desmottes 2015-03-31 13:26:21 +02:00 committed by Vincent Penquerc'h
parent ebf8ea4ed9
commit d7d8fc5652

View file

@ -1423,7 +1423,9 @@ handle_message (GstDiscoverer * dc, GstMessage * msg)
gst_message_parse_toc (msg, &tmp, NULL); gst_message_parse_toc (msg, &tmp, NULL);
GST_DEBUG_OBJECT (GST_MESSAGE_SRC (msg), "Got toc %" GST_PTR_FORMAT, tmp); 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_DEBUG_OBJECT (GST_MESSAGE_SRC (msg), "Current info %p, toc %"
GST_PTR_FORMAT, dc->priv->current_info, tmp); GST_PTR_FORMAT, dc->priv->current_info, tmp);
} }