From fefd6d06a1ede32573730e1f99f19bf1da4b6fd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Zanelli?= Date: Mon, 15 Sep 2014 16:38:17 +0200 Subject: [PATCH] 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 --- libs/gst/base/gstbasesrc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libs/gst/base/gstbasesrc.c b/libs/gst/base/gstbasesrc.c index 921a848f0e..071a109351 100644 --- a/libs/gst/base/gstbasesrc.c +++ b/libs/gst/base/gstbasesrc.c @@ -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, ¶ms); + if (allocator) + gst_object_unref (allocator); + if (pool) + gst_object_unref (pool); + gst_query_unref (query); return result;