summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2014-05-09 08:57:15 +0000
committerBenny Prijono <bennylp@teluu.com>2014-05-09 08:57:15 +0000
commitab55286a96d53393546395fc56068a04ca1aef55 (patch)
tree5e65d0111f04434e8d71249906330d80bf6af5f7
parent06dd1adfd5c56335757779aa6d48bcc7de7faafb (diff)
Re #1768: avoid crash if outgoing call fails during media initialization, because on_call_state() is called with NULL event, which is unexpected by pjsua2 (and possibly other unsuspecting apps)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4843 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjsip/src/pjsua-lib/pjsua_call.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_call.c b/pjsip/src/pjsua-lib/pjsua_call.c
index 35e50a03..45e21326 100644
--- a/pjsip/src/pjsua-lib/pjsua_call.c
+++ b/pjsip/src/pjsua-lib/pjsua_call.c
@@ -516,7 +516,13 @@ on_error:
if (inv == NULL && call_id != -1 && !cb_called &&
pjsua_var.ua_cfg.cb.on_call_state)
{
- (*pjsua_var.ua_cfg.cb.on_call_state)(call_id, NULL);
+ /* Use user event rather than NULL to avoid crash in
+ * unsuspecting app.
+ */
+ pjsip_event user_event;
+ PJSIP_EVENT_INIT_USER(user_event, 0, 0, 0, 0);
+
+ (*pjsua_var.ua_cfg.cb.on_call_state)(call_id, &user_event);
}
if (dlg) {