Message ID | 20200104050947.7673-4-laurent.pinchart@ideasonboard.com |
---|---|
State | Accepted |
Commit | 451ffd1fcd4e1287c3a600e83e61028aab74be59 |
Headers | show |
Series |
|
Related | show |
Hi Laurent, Thanks for your work. On 2020-01-04 07:09:36 +0200, Laurent Pinchart wrote: > 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@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> > --- > 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 > > _______________________________________________ > libcamera-devel mailing list > libcamera-devel@lists.libcamera.org > https://lists.libcamera.org/listinfo/libcamera-devel
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: {
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@ideasonboard.com> --- src/libcamera/bound_method.cpp | 2 ++ 1 file changed, 2 insertions(+)