From 2fe658841986450e652902a4431bffd78bccb2ba Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Thu, 22 Sep 2011 06:13:22 +0000 Subject: 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 --- pjsip/src/pjsua-lib/pjsua_call.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 */ -- cgit v1.2.3