mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 11:58:52 +00:00
Chaos: make hangup NULL tolerant
In chan_pjsip_new, if allocation of the pvt structure fails, ast_hangup is called. But it was written to assume pvt was valid, and this change corrects that. ASTERISK-25323 Reported by: Scott Griepentrog Change-Id: I5f47860fe9cee4cd56abd3f79b108678ab72cc87
This commit is contained in:
committed by
Scott Griepentrog
parent
6b8734fe68
commit
490db8ba94
@@ -1811,9 +1811,17 @@ static int hangup(void *data)
|
||||
static int chan_pjsip_hangup(struct ast_channel *ast)
|
||||
{
|
||||
struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(ast);
|
||||
struct chan_pjsip_pvt *pvt = channel->pvt;
|
||||
int cause = hangup_cause2sip(ast_channel_hangupcause(channel->session->channel));
|
||||
struct hangup_data *h_data = hangup_data_alloc(cause, ast);
|
||||
struct chan_pjsip_pvt *pvt;
|
||||
int cause;
|
||||
struct hangup_data *h_data;
|
||||
|
||||
if (!channel || !channel->session) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
pvt = channel->pvt;
|
||||
cause = hangup_cause2sip(ast_channel_hangupcause(channel->session->channel));
|
||||
h_data = hangup_data_alloc(cause, ast);
|
||||
|
||||
if (!h_data) {
|
||||
goto failure;
|
||||
|
Reference in New Issue
Block a user