Merge "res_pjsip_session: Add cleanup to ast_sip_session_terminate" into 13

This commit is contained in:
Jenkins2
2017-04-27 16:46:17 -05:00
committed by Gerrit Code Review
3 changed files with 47 additions and 5 deletions

View File

@@ -2005,11 +2005,16 @@ static int hangup(void *data)
struct ast_sip_session *session = channel->session;
int cause = h_data->cause;
ast_sip_session_terminate(session, cause);
/*
* It's possible that session_terminate might cause the session to be destroyed
* immediately so we need to keep a reference to it so we can NULL session->channel
* afterwards.
*/
ast_sip_session_terminate(ao2_bump(session), cause);
clear_session_and_channel(session, ast, pvt);
ao2_cleanup(session);
ao2_cleanup(channel);
ao2_cleanup(h_data);
return 0;
}