From 33a0aa38e47ad5bf7358edc54d5a649a422c807b Mon Sep 17 00:00:00 2001 From: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com> Date: Wed, 17 Feb 2016 20:16:43 -0500 Subject: [PATCH] sipaccount: fix nullptr access SipAccount::CheckNATAddress may use regc_ member when this one has been previsouly destroyed and set to nullptr. This patch checks regc_ value and take care to return correctly, to prevent call to pjsip_regc_update_contact with nullptr regc. Change-Id: I97590debd672095fed63ced40d3c541333b773f8 Tuleap: #172 --- src/sip/sipaccount.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/sip/sipaccount.cpp b/src/sip/sipaccount.cpp index d60f56672b..d2ad10a12b 100644 --- a/src/sip/sipaccount.cpp +++ b/src/sip/sipaccount.cpp @@ -1982,6 +1982,10 @@ SIPAccount::checkNATAddress(pjsip_regc_cbparam *param, pj_pool_t *pool) RING_ERR("%s", e.what()); } + // sendUnregister may failed and cause regc_ to be reset to nullptr + // in this case re-registration has been scheduled, so just leave + if (!regc_) + return true; pjsip_regc_update_contact(regc_, 1, &contact_); /* Perform new registration */ -- GitLab