libcamera: v4l2_device: Return a unique pointer from fromEntityName()
The fromEntityName() function returns a pointer to a newly allocated V4L2Device instance, which must be deleted by the caller. This opens the door to memory leaks. Return a unique pointer instead, which conveys the API semantics better than a sentence in the documentation. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
parent
ff2ee0174c
commit
e638ffde53
9 changed files with 18 additions and 36 deletions
|
@ -50,7 +50,7 @@ int BufferSource::allocate(const StreamConfiguration &config)
|
|||
return TestSkip;
|
||||
}
|
||||
|
||||
std::unique_ptr<V4L2VideoDevice> video{ V4L2VideoDevice::fromEntityName(media_.get(), videoDeviceName) };
|
||||
std::unique_ptr<V4L2VideoDevice> video = V4L2VideoDevice::fromEntityName(media_.get(), videoDeviceName);
|
||||
if (!video) {
|
||||
std::cout << "Failed to get video device from entity "
|
||||
<< videoDeviceName << std::endl;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue