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: 771befc6dc ("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>
This commit is contained in:
Kieran Bingham 2019-03-04 23:10:50 +00:00
parent ba90504cac
commit cbdc4b9ad3

View file

@ -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;
}