From 0fb59dbdba3c581a541e3f45a29df2f2ca57de03 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Thu, 12 Jun 2014 16:36:24 -0400 Subject: [PATCH] v4l2bufferpool: Cleanly handle v4l2_allocator_new failure --- sys/v4l2/gstv4l2bufferpool.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c index 72405df87c..f5c74c8f2c 100644 --- a/sys/v4l2/gstv4l2bufferpool.c +++ b/sys/v4l2/gstv4l2bufferpool.c @@ -1418,6 +1418,8 @@ gst_v4l2_buffer_pool_new (GstV4l2Object * obj, GstCaps * caps) pool->vallocator = gst_v4l2_allocator_new (GST_OBJECT (pool), obj->video_fd, &obj->format); + if (pool->vallocator == NULL) + goto allocator_failed; gst_object_ref (obj->element); @@ -1435,6 +1437,11 @@ dup_failed: GST_ERROR ("failed to dup fd %d (%s)", errno, g_strerror (errno)); return NULL; } +allocator_failed: + { + GST_ERROR_OBJECT (pool, "Failed to create V4L2 allocator"); + return NULL; + } } static GstFlowReturn