diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2022-10-03 22:55:11 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2022-10-07 18:02:16 +0300 |
commit | 9d9481188fc3a4291b33a2d53e9e331cc2d7a023 (patch) | |
tree | c6ad56dddb93483183c91f22f92f6923a94318db /src/ipa/libipa/camera_sensor_helper.cpp | |
parent | b4a3e6ade7864620e453ad81595407aac1979dee (diff) |
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>
Diffstat (limited to 'src/ipa/libipa/camera_sensor_helper.cpp')
-rw-r--r-- | src/ipa/libipa/camera_sensor_helper.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp index fde9bf5b..3a7d701d 100644 --- a/src/ipa/libipa/camera_sensor_helper.cpp +++ b/src/ipa/libipa/camera_sensor_helper.cpp @@ -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 */ /** |