libcamera: v4l2_subdevice: Close subdevice when destroyed
Make sure the subdevice file descriptor isn't leaked by closing it when the V4L2Subdevice instance is destroyed. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
@@ -35,6 +35,7 @@ public:
|
||||
explicit V4L2Subdevice(const MediaEntity *entity);
|
||||
V4L2Subdevice(const V4L2Subdevice &) = delete;
|
||||
V4L2Subdevice &operator=(const V4L2Subdevice &) = delete;
|
||||
~V4L2Subdevice();
|
||||
|
||||
int open();
|
||||
bool isOpen() const;
|
||||
|
||||
@@ -112,6 +112,11 @@ V4L2Subdevice::V4L2Subdevice(const MediaEntity *entity)
|
||||
{
|
||||
}
|
||||
|
||||
V4L2Subdevice::~V4L2Subdevice()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Open a V4L2 subdevice
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user