From ccfd3c7b2d94ef90b88b69a7867f92f33b01e14e Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 9 Aug 2012 14:47:20 +0200 Subject: [PATCH] Update of ICE from remote media description may delete the ICE session, so check that the session exists after the update to prevent crashes. --- coreapi/linphonecall.c | 14 ++++++++------ coreapi/linphonecore.c | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 4cd4a073..36ffc4f8 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -392,12 +392,14 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro call->ice_session = ice_session_new(); ice_session_set_role(call->ice_session, IR_Controlled); linphone_core_update_ice_from_remote_media_description(call, sal_call_get_remote_media_description(op)); - linphone_call_init_media_streams(call); - linphone_call_start_media_streams_for_ice_gathering(call); - if (linphone_core_gather_ice_candidates(call->core,call)<0) { - /* Ice candidates gathering failed, proceed with the call anyway. */ - linphone_call_delete_ice_session(call); - linphone_call_stop_media_streams(call); + if (call->ice_session != NULL) { + linphone_call_init_media_streams(call); + linphone_call_start_media_streams_for_ice_gathering(call); + if (linphone_core_gather_ice_candidates(call->core,call)<0) { + /* Ice candidates gathering failed, proceed with the call anyway. */ + linphone_call_delete_ice_session(call); + linphone_call_stop_media_streams(call); + } } break; case LinphonePolicyUseStun: diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index b8911702..3b8a274b 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2593,7 +2593,7 @@ int linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, const update_local_media_description(lc,call); if (call->ice_session != NULL) { linphone_core_update_ice_from_remote_media_description(call, sal_call_get_remote_media_description(call->op)); - if (!ice_session_candidates_gathered(call->ice_session)) { + if ((call->ice_session != NULL) &&!ice_session_candidates_gathered(call->ice_session)) { if ((call->params.has_video) && (call->params.has_video != old_has_video)) { linphone_call_init_video_stream(call); video_stream_prepare_video(call->videostream); -- 2.39.2