libcamera: Replace plain pointers with std::unique<>

libcamera uses std::unique_ptr<> to simplify life time management of
objects and avoid leaks. For historical reasons there are a fair number
of plain pointers with manual memory management. Replace them with
std::unique_ptr<> when the conversion is simple.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
This commit is contained in:
Laurent Pinchart
2025-10-15 17:06:51 +03:00
parent 0f9b73bae2
commit 1e4e158d98
16 changed files with 48 additions and 62 deletions
@@ -279,7 +279,7 @@ as the parameter of the ``FrameBufferAllocator::buffers()`` function.
.. code:: cpp
FrameBufferAllocator *allocator = new FrameBufferAllocator(camera);
auto allocator = std::make_unique<FrameBufferAllocator>(camera);
for (StreamConfiguration &cfg : *config) {
int ret = allocator->allocate(cfg.stream());
@@ -539,7 +539,7 @@ uses, so needs to do the following:
camera->stop();
allocator->free(stream);
delete allocator;
allocator.reset();
camera->release();
camera.reset();
cm->stop();