From 08dc49d1b9cc0e9ab61c9ecb550ae6f6c1dc4a6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com> Date: Fri, 26 Feb 2021 11:53:16 -0500 Subject: [PATCH] SipCall: capture weak_ptr instead of this to avoid use-after-free Change-Id: I92a9a61c8d34736af99693ec826dd2385c319bfa --- src/sip/sipcall.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sip/sipcall.cpp b/src/sip/sipcall.cpp index 4dd2c37dc3..e77e5724ee 100644 --- a/src/sip/sipcall.cpp +++ b/src/sip/sipcall.cpp @@ -1241,7 +1241,10 @@ SIPCall::startAllMedia() rtp->updateMedia(remote, local); rtp->setSuccessfulSetupCb( - [this](MediaType type, bool isRemote) { rtpSetupSuccess(type, isRemote); }); + [wthis = weak()](MediaType type, bool isRemote) { + if (auto this_ = wthis.lock()) + this_->rtpSetupSuccess(type, isRemote); + }); #ifdef ENABLE_VIDEO videortp_->setRequestKeyFrameCallback([wthis = weak()] { -- GitLab