From patchwork Mon Sep 16 20:18:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 1977 Return-Path: Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6B78F60BE6 for ; Mon, 16 Sep 2019 22:17:28 +0200 (CEST) X-Originating-IP: 85.243.204.24 Received: from uno.lan (bl10-204-24.dsl.telepac.pt [85.243.204.24]) (Authenticated sender: jacopo@jmondi.org) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id DCACC24000A for ; Mon, 16 Sep 2019 20:17:27 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Mon, 16 Sep 2019 22:18:59 +0200 Message-Id: <20190916201859.26553-1-jacopo@jmondi.org> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] test: buffer_import: Initialize media_ and video_ 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: Mon, 16 Sep 2019 20:17:28 -0000 When the vivid module used to test buffer importing is not loaded, the test correctly bails out, but during the clean up procedure tries to access the video_ fields, which, if not correctly initialized to nullptr, contains random values and accessing it cause a segfault. Fix this by initializing video_ field to nullptr to make sure it is properly handled in cleanup(). Fixes: e1a5873701a9 ("test: camera: Add buffer import and mapping test") Reviewed-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- test/camera/buffer_import.cpp | 5 +++++ 1 file changed, 5 insertions(+) -- 2.23.0 diff --git a/test/camera/buffer_import.cpp b/test/camera/buffer_import.cpp index 9364e3d1bc44..9cac19d8ce81 100644 --- a/test/camera/buffer_import.cpp +++ b/test/camera/buffer_import.cpp @@ -28,6 +28,11 @@ static constexpr unsigned int CAMERA_BUFFER_COUNT = 4; class FrameSink { public: + FrameSink() + : video_(nullptr) + { + } + int init() { int ret;