mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-15 08:25:07 +03:00
ipa: camera_sensor_helper: Return unique_ptr from createInstance
Avoid naked pointer with memory allocation by returning a unique_ptr from CameraSensorHelperFactory::createInstance(), in order to increase memory allocation safety. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Xavier Roumegue <xavier.roumegue@oss.nxp.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
parent
b4a3e6ade7
commit
9d9481188f
2 changed files with 6 additions and 7 deletions
|
@ -261,8 +261,7 @@ std::unique_ptr<CameraSensorHelper> CameraSensorHelperFactory::create(const std:
|
|||
if (name != factory->name_)
|
||||
continue;
|
||||
|
||||
CameraSensorHelper *helper = factory->createInstance();
|
||||
return std::unique_ptr<CameraSensorHelper>(helper);
|
||||
return factory->createInstance();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
@ -307,8 +306,8 @@ std::vector<CameraSensorHelperFactory *> &CameraSensorHelperFactory::factories()
|
|||
* macro. It creates a camera sensor helper instance associated with the camera
|
||||
* sensor model.
|
||||
*
|
||||
* \return A pointer to a newly constructed instance of the CameraSensorHelper
|
||||
* subclass corresponding to the factory
|
||||
* \return A unique pointer to a newly constructed instance of the
|
||||
* CameraSensorHelper subclass corresponding to the factory
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue