summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKieran Bingham <kieran.bingham@ideasonboard.com>2019-03-04 23:10:50 +0000
committerKieran Bingham <kieran.bingham@ideasonboard.com>2019-03-05 15:06:29 +0000
commitcbdc4b9ad3807d31e2942690beb9cae18091ad89 (patch)
tree8deabc83f7def9c10fc22810d29abaab1aa9cbd7
parentba90504cace9f2e53e47e0f9573604ff8e73ed7e (diff)
libcamera: v4l2_device: Close Plane dmabuf fd
When constructing a Plane, the exported buffer provides a dmabuf handle which is set to the Plane object. This action duplicates the handle for internal storage, and the original fd is not used and needs to be closed. Close the handle, ensuring that the resources can be correctly managed. Fixes: 771befc6dc0e ("libcamera: v4l2_device: Request buffers from the device") Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
-rw-r--r--src/libcamera/v4l2_device.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
index 0cd9f4b8..a88a5f5f 100644
--- a/src/libcamera/v4l2_device.cpp
+++ b/src/libcamera/v4l2_device.cpp
@@ -676,6 +676,7 @@ int V4L2Device::createPlane(Buffer *buffer, unsigned int planeIndex,
buffer->planes().emplace_back();
Plane &plane = buffer->planes().back();
plane.setDmabuf(expbuf.fd, length);
+ ::close(expbuf.fd);
return 0;
}