From ab55286a96d53393546395fc56068a04ca1aef55 Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Fri, 9 May 2014 08:57:15 +0000 Subject: 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 --- pjsip/src/pjsua-lib/pjsua_call.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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) { -- cgit v1.2.3