From patchwork Thu Aug 12 17:39:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 13339 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 BA519C3240 for ; Thu, 12 Aug 2021 17:38:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7C8A66888A; Thu, 12 Aug 2021 19:38:28 +0200 (CEST) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 98B9068823 for ; Thu, 12 Aug 2021 19:38:27 +0200 (CEST) Received: (Authenticated sender: jacopo@jmondi.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 047E41C0002; Thu, 12 Aug 2021 17:38:26 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Thu, 12 Aug 2021 19:39:07 +0200 Message-Id: <20210812173907.204700-1-jacopo@jmondi.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] libcamera: controls: Initialize ControlInfoMap::idmap_ 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" The compiler generated constructor does not initialize the ControlInfoMap::idmap_ field. Fix this by explicitly defining an empty constructor for the class. Reported-by: Coverity CID=354657 Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- include/libcamera/controls.h | 2 +- src/libcamera/controls.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index 9b0d5a545301..7352c62ec03c 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -307,7 +307,7 @@ class ControlInfoMap : private std::unordered_map; - ControlInfoMap() = default; + ControlInfoMap(); ControlInfoMap(const ControlInfoMap &other) = default; ControlInfoMap(std::initializer_list init, const ControlIdMap &idmap); diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp index 5c05ba4a7cd0..83f61fd96b24 100644 --- a/src/libcamera/controls.cpp +++ b/src/libcamera/controls.cpp @@ -636,6 +636,14 @@ std::string ControlInfo::toString() const * \brief The base std::unsorted_map<> container */ +/** + * \brief Construct an empty ControlInfoMap + */ +ControlInfoMap::ControlInfoMap() + : idmap_(nullptr) +{ +} + /** * \fn ControlInfoMap::ControlInfoMap(const ControlInfoMap &other) * \brief Copy constructor, construct a ControlInfoMap from a copy of \a other