[libcamera-devel] [PATCH 03/14] libcamera: bound_method: Fix memory leak with direct connections
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Sat Jan 4 06:09:36 CET 2020
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 <laurent.pinchart at ideasonboard.com>
---
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: {
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list