From patchwork Sun Aug 2 23:16:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 9135 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 D7740BD86F for ; Sun, 2 Aug 2020 23:17:03 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AE76E609B2; Mon, 3 Aug 2020 01:17:03 +0200 (CEST) Received: from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net [195.74.38.229]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D98D760398 for ; Mon, 3 Aug 2020 01:17:02 +0200 (CEST) X-Halon-ID: 3ff37259-d516-11ea-933e-005056917a89 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (p54ac52a8.dip0.t-ipconnect.de [84.172.82.168]) by bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA id 3ff37259-d516-11ea-933e-005056917a89; Mon, 03 Aug 2020 01:17:00 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Mon, 3 Aug 2020 01:16:52 +0200 Message-Id: <20200802231652.360645-1-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] libcamera: device_enumerator_udev: Initialize monitor_ and notifier_ to nullptr 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 monitor_ and notifier_ pointers are acted on in the destructor if not set to nullptr, the pointers are however first initialized in enumerate(). If the object is deleted without enumerate() being called the destructor acts on uninitialized pointers, fix this by initializing them to nullptr. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart Reviewed-by: Umang Jain --- src/libcamera/device_enumerator_udev.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcamera/device_enumerator_udev.cpp b/src/libcamera/device_enumerator_udev.cpp index 56ca4dc2804b46b9..96689daa5dd113dc 100644 --- a/src/libcamera/device_enumerator_udev.cpp +++ b/src/libcamera/device_enumerator_udev.cpp @@ -27,7 +27,7 @@ namespace libcamera { LOG_DECLARE_CATEGORY(DeviceEnumerator) DeviceEnumeratorUdev::DeviceEnumeratorUdev() - : udev_(nullptr) + : udev_(nullptr), monitor_(nullptr), notifier_(nullptr) { }