v4l2bufferpool: return TRUE when buffer pool orphaning succeeds
authorDamian Hobson-Garcia <dhobsong@igel.co.jp>
Thu, 30 May 2019 02:13:07 +0000 (11:13 +0900)
committerTim-Philipp Müller <tim@centricular.com>
Wed, 7 Aug 2019 22:57:48 +0000 (23:57 +0100)
When trying to orphan a buffer pool, successfully return and unref
the pool when the pool is either successfully stopped or orphaned.
Indicate failure and leave the pool untouched otherwise.

sys/v4l2/gstv4l2bufferpool.c

index 282a02e..d7fa9fa 100644 (file)
@@ -1003,11 +1003,16 @@ gst_v4l2_buffer_pool_orphan (GstBufferPool ** bpool)
    */
   ret = gst_v4l2_buffer_pool_stop (*bpool);
   if (!ret)
-    gst_v4l2_allocator_orphan (pool->vallocator);
+    ret = gst_v4l2_allocator_orphan (pool->vallocator);
+
+  if (!ret)
+    goto orphan_failed;
 
   pool->orphaned = TRUE;
   gst_object_unref (*bpool);
   *bpool = NULL;
+
+orphan_failed:
   return ret;
 }