From 451ffd1fcd4e1287c3a600e83e61028aab74be59 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sat, 4 Jan 2020 05:13:35 +0200 Subject: libcamera: bound_method: Fix memory leak with direct connections MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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(+) (limited to 'src/libcamera') diff --git a/src/libcamera/bound_method.cpp b/src/libcamera/bound_method.cpp index 4c0cd415..45c76577 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: { -- cgit v1.2.1