[PATCH] libcamera: software_isp: Replace malloc() with new[]()
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Sat Aug 3 23:10:07 CEST 2024
libcamera is implemented in C++, use new[]() instead of malloc() (and
delete[]() instead of free()).
Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
src/libcamera/software_isp/debayer_cpu.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp
index f8d2677d657a..249294efca01 100644
--- a/src/libcamera/software_isp/debayer_cpu.cpp
+++ b/src/libcamera/software_isp/debayer_cpu.cpp
@@ -57,7 +57,7 @@ DebayerCpu::DebayerCpu(std::unique_ptr<SwStatsCpu> stats)
DebayerCpu::~DebayerCpu()
{
for (unsigned int i = 0; i < kMaxLineBuffers; i++)
- free(lineBuffers_[i]);
+ delete[] lineBuffers_[i];
}
#define DECLARE_SRC_POINTERS(pixel_t) \
@@ -529,8 +529,8 @@ int DebayerCpu::configure(const StreamConfiguration &inputCfg,
for (unsigned int i = 0;
i < (inputConfig_.patternSize.height + 1) && enableInputMemcpy_;
i++) {
- free(lineBuffers_[i]);
- lineBuffers_[i] = (uint8_t *)malloc(lineBufferLength_);
+ delete[] lineBuffers_[i];
+ lineBuffers_[i] = new uint8_t[lineBufferLength_];
if (!lineBuffers_[i])
return -ENOMEM;
}
base-commit: 19bbca3c0b376ba0183f5db53472c8c46cd402b5
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list