From cbdc4b9ad3807d31e2942690beb9cae18091ad89 Mon Sep 17 00:00:00 2001 From: Kieran Bingham Date: Mon, 4 Mar 2019 23:10:50 +0000 Subject: 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 Signed-off-by: Kieran Bingham --- src/libcamera/v4l2_device.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/libcamera/v4l2_device.cpp') 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; } -- cgit v1.2.1