From patchwork Sat Jan 4 05:09:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 2499 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EDED960466 for ; Sat, 4 Jan 2020 06:10:03 +0100 (CET) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8A906A49 for ; Sat, 4 Jan 2020 06:10:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1578114603; bh=iuKvvqBOOmGKweNTex1vbZX9NzTjfQrevg48E95VhDM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=X7ghZHeXl6j+5w6TCeIJYu5QP08KfBcxT9uSGo2gAU9OFah6StJopQdon6XD16NZr CO7sJHiqy4k82mjpyEnjfp7orSHs4E0l0PAu3KOwbAuP9z/oCS/neDtpjLV7LPtcF/ 22/0jeN3YLJyLe+1d+PRvUFTLgNA2384tYEPhhk0= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Sat, 4 Jan 2020 07:09:36 +0200 Message-Id: <20200104050947.7673-4-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200104050947.7673-1-laurent.pinchart@ideasonboard.com> References: <20200104050947.7673-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 03/14] libcamera: bound_method: Fix memory leak with direct connections 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: , X-List-Received-Date: Sat, 04 Jan 2020 05:10:04 -0000 When BoundMethodBase::activatePack() is called with the connection type set to ConnectionTypeDirect, the method isn't deleted even if deleteMethod is true, as is the case when called from Object::invokeMethod(). This causes a memory leak. Fix it. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/libcamera/bound_method.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libcamera/bound_method.cpp b/src/libcamera/bound_method.cpp index 4c0cd415a3f1..45c765774801 100644 --- a/src/libcamera/bound_method.cpp +++ b/src/libcamera/bound_method.cpp @@ -62,6 +62,8 @@ void BoundMethodBase::activatePack(void *pack, bool deleteMethod) case ConnectionTypeDirect: default: invokePack(pack); + if (deleteMethod) + delete this; break; case ConnectionTypeQueued: {