[#2519] Fix NULL pointer when TLS transport set to account

This commit is contained in:
Alexandre Savard
2009-12-17 10:41:12 -05:00
parent 0cbaa83a46
commit 4640d7604c

View File

@ -458,10 +458,12 @@ int SIPVoIPLink::sendRegister (AccountID id)
// transport we tried to create)
acquireTransport(account->getAccountID());
if (account->getAccountTransport()) {
_debug("Acquire transport in account registration: %s %s (refcnt=%d)\n",
account->getAccountTransport()->obj_name,
account->getAccountTransport()->info,
(int)pj_atomic_get(account->getAccountTransport()->ref_cnt));
}
_mutexSIP.enterMutex();
@ -574,6 +576,7 @@ int SIPVoIPLink::sendRegister (AccountID id)
// pjsip_regc_set_transport increments transport ref count by one
status = pjsip_regc_set_transport (regc, tp);
if(account->getAccountTransport()) {
// decrease transport's ref count, counter icrementation is
// managed when acquiring transport
pjsip_transport_dec_ref(account->getAccountTransport ());
@ -582,7 +585,7 @@ int SIPVoIPLink::sendRegister (AccountID id)
account->getAccountTransport()->obj_name,
account->getAccountTransport()->info,
(int)pj_atomic_get(account->getAccountTransport()->ref_cnt));
}
if (status != PJ_SUCCESS) {
_debug ("UserAgent: Unable to set transport.");
@ -594,10 +597,12 @@ int SIPVoIPLink::sendRegister (AccountID id)
// pjsip_regc_send increment the transport ref count by one,
status = pjsip_regc_send (regc, tdata);
if(account->getAccountTransport()) {
// Decrease transport's ref count, since coresponding reference counter decrementation
// is performed in pjsip_regc_destroy. This function is never called in SFLphone as the
// regc data structure is permanently associated to the account at first registration.
pjsip_transport_dec_ref(account->getAccountTransport ());
}
if (status != PJ_SUCCESS) {
_debug ("UserAgent: Unable to send regc request.");
@ -609,11 +614,13 @@ int SIPVoIPLink::sendRegister (AccountID id)
account->setRegistrationInfo (regc);
if(account->getAccountTransport()) {
_debug("Sent account registration using transport: %s %s (refcnt=%d)\n",
account->getAccountTransport()->obj_name,
account->getAccountTransport()->info,
(int)pj_atomic_get(account->getAccountTransport()->ref_cnt));
}
return true;
}