From patchwork Sat Aug 3 21:10:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 20751 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 0329EC323E for ; Sat, 3 Aug 2024 21:10:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9FB6B63381; Sat, 3 Aug 2024 23:10:29 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Nqb8Bu/0"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A8F156336E for ; Sat, 3 Aug 2024 23:10:28 +0200 (CEST) Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 588F6512 for ; Sat, 3 Aug 2024 23:09:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1722719378; bh=qXAaJCNUcB/oP9r356tFFVg5MbO+Q7/O5WQR8aLmYiU=; h=From:To:Subject:Date:From; b=Nqb8Bu/0saTb8WRBM1q36llXnFG5xj9vi/RHMv7fLmubOTicWqVIJbt9vRR7Romh+ poQlnjubBtIkfnIUN8oilxCGCmmcu4oOg18GSA6EwZCjc2DOmN7HaqtSEOpaYjEt8E n9+lMD9AIbF1j7lxYckn43EGcwTgVh8DMqDOPBY8= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Subject: [PATCH] libcamera: software_isp: Replace malloc() with new[]() Date: Sun, 4 Aug 2024 00:10:07 +0300 Message-ID: <20240803211007.18330-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.44.2 MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" libcamera is implemented in C++, use new[]() instead of malloc() (and delete[]() instead of free()). Signed-off-by: Laurent Pinchart --- src/libcamera/software_isp/debayer_cpu.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) base-commit: 19bbca3c0b376ba0183f5db53472c8c46cd402b5 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 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; }