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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user