From patchwork Wed Jan 2 11:31:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 132 Return-Path: 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 4C87360B2F for ; Wed, 2 Jan 2019 12:30:25 +0100 (CET) Received: from avalon.bb.dnainternet.fi (dfj612ybrt5fhg77mgycy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:2e86:4862:ef6a:2804]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C29AD505 for ; Wed, 2 Jan 2019 12:30:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1546428624; bh=XJMqLPdGtfYjW6vS+xgDQ6pI2IYlccJEQP6yXXNH4cY=; h=From:To:Subject:Date:From; b=Q5KBv2OFf41HSt4rbaJ/6dQsF0LSOyWrdUtp5cE0v3xA5hw8nVdclEsX1cNSeS2nK x2HbBa+N8d5ZQJ703hPfWlDdwcvMHZhhA8ao/u6YfAzscuMpWtDILg9yNcnEKbo1db Rqvne6YsLBBHnWcuLPweVoxU2JvEs3lgIg/Al70g= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Wed, 2 Jan 2019 13:31:22 +0200 Message-Id: <20190102113122.12751-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] libcamera: media_device: Zero media graph arrays when querying topology X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jan 2019 11:30:25 -0000 This silences valgrind that otherwise warns about usage of uninitialized values. While not strictly required as the kernel should fill the whole arrays in MEDIA_IOC_G_TOPOLOGY, the extra cost, in a non-critical path, is negligible compared to the ability to run without valgrind warnings. Signed-off-by: Laurent Pinchart --- src/libcamera/media_device.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp index 4ff9ffe1041d..cc307dac1c33 100644 --- a/src/libcamera/media_device.cpp +++ b/src/libcamera/media_device.cpp @@ -240,10 +240,10 @@ int MediaDevice::populate() delete[] pads; delete[] interfaces; - ents = new media_v2_entity[topology.num_entities]; - links = new media_v2_link[topology.num_links]; - pads = new media_v2_pad[topology.num_pads]; - interfaces = new media_v2_interface[topology.num_interfaces]; + ents = new media_v2_entity[topology.num_entities](); + links = new media_v2_link[topology.num_links](); + pads = new media_v2_pad[topology.num_pads](); + interfaces = new media_v2_interface[topology.num_interfaces](); version = topology.topology_version; }