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:
@@ -210,8 +210,8 @@ public:
|
||||
int streamOn();
|
||||
int streamOff();
|
||||
|
||||
static V4L2VideoDevice *fromEntityName(const MediaDevice *media,
|
||||
const std::string &entity);
|
||||
static std::unique_ptr<V4L2VideoDevice>
|
||||
fromEntityName(const MediaDevice *media, const std::string &entity);
|
||||
|
||||
V4L2PixelFormat toV4L2PixelFormat(const PixelFormat &pixelFormat);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user