diff options
author | Benny Prijono <bennylp@teluu.com> | 2011-09-22 06:13:22 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2011-09-22 06:13:22 +0000 |
commit | 2fe658841986450e652902a4431bffd78bccb2ba (patch) | |
tree | 048aa10ce64d322f84abb363e05a8ab0ec480894 | |
parent | 461337c8c702cb5fc6386a3634736249ebee6353 (diff) |
Fixed #1376: Crash if pjsua_call_get_info() is called with disconnected call
git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/1.x@3768 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_call.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_call.c b/pjsip/src/pjsua-lib/pjsua_call.c index 1e29634a..1899d662 100644 --- a/pjsip/src/pjsua-lib/pjsua_call.c +++ b/pjsip/src/pjsua-lib/pjsua_call.c @@ -1241,7 +1241,7 @@ pj_status_t acquire_call(const char *title, PJ_DEF(pjsua_conf_port_id) pjsua_call_get_conf_port(pjsua_call_id call_id) { pjsua_call *call; - pjsua_conf_port_id port_id; + pjsua_conf_port_id port_id = PJSUA_INVALID_ID; PJ_ASSERT_RETURN(call_id>=0 && call_id<(int)pjsua_var.ua_cfg.max_calls, PJ_EINVAL); @@ -1251,9 +1251,13 @@ PJ_DEF(pjsua_conf_port_id) pjsua_call_get_conf_port(pjsua_call_id call_id) */ PJSUA_LOCK(); + if (!pjsua_call_is_active(call_id)) + goto on_return; + call = &pjsua_var.calls[call_id]; port_id = call->conf_slot; +on_return: PJSUA_UNLOCK(); return port_id; @@ -1279,6 +1283,11 @@ PJ_DEF(pj_status_t) pjsua_call_get_info( pjsua_call_id call_id, */ PJSUA_LOCK(); + if (!pjsua_call_is_active(call_id)) { + PJSUA_UNLOCK(); + return PJSIP_ESESSIONTERMINATED; + } + call = &pjsua_var.calls[call_id]; /* id and role */ |