{"id":132,"url":"https://patchwork.libcamera.org/api/1.1/patches/132/?format=json","web_url":"https://patchwork.libcamera.org/patch/132/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20190102113122.12751-1-laurent.pinchart@ideasonboard.com>","date":"2019-01-02T11:31:22","name":"[libcamera-devel] libcamera: media_device: Zero media graph arrays when querying topology","commit_ref":"c59272f417e03e1a64d12296d66ba0004f0aa78c","pull_url":null,"state":"accepted","archived":false,"hash":"c32f7be13a1db238142976e55dc4c73fb61f3ed7","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/132/mbox/","series":[{"id":49,"url":"https://patchwork.libcamera.org/api/1.1/series/49/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=49","date":"2019-01-02T11:31:22","name":"[libcamera-devel] libcamera: media_device: Zero media graph arrays when querying topology","version":1,"mbox":"https://patchwork.libcamera.org/series/49/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/132/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/132/checks/","tags":{},"headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4C87360B2F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  2 Jan 2019 12:30:25 +0100 (CET)","from avalon.bb.dnainternet.fi\n\t(dfj612ybrt5fhg77mgycy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:2e86:4862:ef6a:2804])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C29AD505\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  2 Jan 2019 12:30:24 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1546428624;\n\tbh=XJMqLPdGtfYjW6vS+xgDQ6pI2IYlccJEQP6yXXNH4cY=;\n\th=From:To:Subject:Date:From;\n\tb=Q5KBv2OFf41HSt4rbaJ/6dQsF0LSOyWrdUtp5cE0v3xA5hw8nVdclEsX1cNSeS2nK\n\tx2HbBa+N8d5ZQJ703hPfWlDdwcvMHZhhA8ao/u6YfAzscuMpWtDILg9yNcnEKbo1db\n\tRqvne6YsLBBHnWcuLPweVoxU2JvEs3lgIg/Al70g=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","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","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH] libcamera: media_device: Zero media graph\n\tarrays when querying topology","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Wed, 02 Jan 2019 11:30:25 -0000"},"content":"This silences valgrind that otherwise warns about usage of uninitialized\nvalues. While not strictly required as the kernel should fill the whole\narrays in MEDIA_IOC_G_TOPOLOGY, the extra cost, in a non-critical path,\nis negligible compared to the ability to run without valgrind warnings.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/media_device.cpp | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)","diff":"diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp\nindex 4ff9ffe1041d..cc307dac1c33 100644\n--- a/src/libcamera/media_device.cpp\n+++ b/src/libcamera/media_device.cpp\n@@ -240,10 +240,10 @@ int MediaDevice::populate()\n \t\tdelete[] pads;\n \t\tdelete[] interfaces;\n \n-\t\tents = new media_v2_entity[topology.num_entities];\n-\t\tlinks = new media_v2_link[topology.num_links];\n-\t\tpads = new media_v2_pad[topology.num_pads];\n-\t\tinterfaces = new media_v2_interface[topology.num_interfaces];\n+\t\tents = new media_v2_entity[topology.num_entities]();\n+\t\tlinks = new media_v2_link[topology.num_links]();\n+\t\tpads = new media_v2_pad[topology.num_pads]();\n+\t\tinterfaces = new media_v2_interface[topology.num_interfaces]();\n \n \t\tversion = topology.topology_version;\n \t}\n","prefixes":["libcamera-devel"]}