Ticket #349: Crash when sending PUBLISH when network is unreachable

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@1398 74dad513-b988-da41-8d7b-12977e46ad98
This commit is contained in:
Benny Prijono 2007-06-28 02:47:32 +00:00
parent 18a051b8c0
commit 2943815a60
2 changed files with 12 additions and 6 deletions

View file

@ -596,11 +596,13 @@ PJ_DEF(pj_status_t) pjsip_publishc_send(pjsip_publishc *pubc,
status = pjsip_endpt_send_request(pubc->endpt, tdata, -1, pubc,
&tsx_callback);
if (status!=PJ_SUCCESS) {
--pubc->pending_tsx;
// no need to decrement, callback has been called and it should
// already decremented pending_tsx. Decrementing this here may
// cause accessing freed memory location.
//--pubc->pending_tsx;
PJ_LOG(4,(THIS_FILE, "Error sending request, status=%d", status));
}
return status;
}

View file

@ -699,8 +699,10 @@ static pj_status_t send_publish(int acc_id, pj_bool_t active)
return PJ_SUCCESS;
on_error:
pjsip_publishc_destroy(acc->publish_sess);
acc->publish_sess = NULL;
if (acc->publish_sess) {
pjsip_publishc_destroy(acc->publish_sess);
acc->publish_sess = NULL;
}
return status;
}
@ -735,8 +737,10 @@ pj_status_t pjsua_pres_init_publish_acc(int acc_id)
}
/* Add credential for authentication */
pjsip_publishc_set_credentials(acc->publish_sess, acc->cred_cnt,
acc->cred);
if (acc->cred_cnt) {
pjsip_publishc_set_credentials(acc->publish_sess, acc->cred_cnt,
acc->cred);
}
/* Set route-set */
pjsip_publishc_set_route_set(acc->publish_sess, &acc->route_set);