basesrc: handle reference in set_allocation rather than in prepare_allocation

Otherwise we can forget to unref objects in error cases.

https://bugzilla.gnome.org/show_bug.cgi?id=736680
This commit is contained in:
Aurélien Zanelli 2014-09-15 16:38:17 +02:00 committed by Sebastian Dröge
parent 84c6e885f1
commit fefd6d06a1

View file

@ -2965,6 +2965,11 @@ gst_base_src_set_allocation (GstBaseSrc * basesrc, GstBufferPool * pool,
oldalloc = priv->allocator;
priv->allocator = allocator;
if (priv->pool)
gst_object_ref (priv->pool);
if (priv->allocator)
gst_object_ref (priv->allocator);
if (params)
priv->params = *params;
else
@ -3141,6 +3146,11 @@ gst_base_src_prepare_allocation (GstBaseSrc * basesrc, GstCaps * caps)
result = gst_base_src_set_allocation (basesrc, pool, allocator, &params);
if (allocator)
gst_object_unref (allocator);
if (pool)
gst_object_unref (pool);
gst_query_unref (query);
return result;