From 87075463458dac90103da1c324e88f8da722d017 Mon Sep 17 00:00:00 2001 From: Sreerenj Balachandran Date: Wed, 8 Aug 2012 12:06:45 +0300 Subject: [PATCH] videofilter: Fix the crash in propose_allocation Always set a buffer pool if none is provided and don't set/unref a NULL buffer pool on the query. https://bugzilla.gnome.org/show_bug.cgi?id=681436 --- gst-libs/gst/video/gstvideofilter.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/gst-libs/gst/video/gstvideofilter.c b/gst-libs/gst/video/gstvideofilter.c index 97d12a4..c21358c 100644 --- a/gst-libs/gst/video/gstvideofilter.c +++ b/gst-libs/gst/video/gstvideofilter.c @@ -59,7 +59,6 @@ gst_video_filter_propose_allocation (GstBaseTransform * trans, GstVideoInfo info; GstBufferPool *pool; GstCaps *caps; - gboolean need_pool; guint size; if (!GST_BASE_TRANSFORM_CLASS (parent_class)->propose_allocation (trans, @@ -70,7 +69,7 @@ gst_video_filter_propose_allocation (GstBaseTransform * trans, if (decide_query == NULL) return TRUE; - gst_query_parse_allocation (query, &caps, &need_pool); + gst_query_parse_allocation (query, &caps, NULL); if (caps == NULL) return FALSE; @@ -80,7 +79,7 @@ gst_video_filter_propose_allocation (GstBaseTransform * trans, size = GST_VIDEO_INFO_SIZE (&info); - if (need_pool) { + if (gst_query_get_n_allocation_pools (query) < 0) { GstStructure *structure; static GstAllocationParams params = { 0, 0, 0, 15, }; @@ -92,13 +91,11 @@ gst_video_filter_propose_allocation (GstBaseTransform * trans, if (!gst_buffer_pool_set_config (pool, structure)) goto config_failed; - } else - pool = NULL; - gst_query_add_allocation_pool (query, pool, size, 0, 0); - gst_object_unref (pool); - - gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL); + gst_query_add_allocation_pool (query, pool, size, 0, 0); + gst_object_unref (pool); + gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL); + } return TRUE; -- 2.7.4