v4l2allocator: fix fd leak in DMABUF import mode.
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Mon, 2 Mar 2015 11:04:00 +0000 (12:04 +0100)
committerNicolas Dufresne <nicolas.dufresne@collabora.com>
Mon, 2 Mar 2015 20:10:51 +0000 (15:10 -0500)
Ensure gst_v4l2_buffer_pool_release_buffer() releases the associated
GstV4l2MemoryGroup. In particular, this allows for closing the DMABUF
handles prior to instantiating new ones.

https://bugzilla.gnome.org/show_bug.cgi?id=745443

sys/v4l2/gstv4l2bufferpool.c

index e0604dc..3f36cea 100644 (file)
@@ -1364,7 +1364,9 @@ gst_v4l2_buffer_pool_release_buffer (GstBufferPool * bpool, GstBuffer * buffer)
         case GST_V4L2_IO_USERPTR:
         case GST_V4L2_IO_DMABUF_IMPORT:
         {
-          if (gst_v4l2_is_buffer_valid (buffer, NULL)) {
+          GstV4l2MemoryGroup *group;
+          if (gst_v4l2_is_buffer_valid (buffer, &group)) {
+            gst_v4l2_allocator_reset_group (pool->vallocator, group);
             /* queue back in the device */
             if (pool->other_pool)
               gst_v4l2_buffer_pool_prepare_buffer (pool, buffer, NULL);