[Asterisk-code-review] Chaos: make hangup NULL tolerant (asterisk[13])
Scott Griepentrog
asteriskteam at digium.com
Wed Aug 26 15:19:20 CDT 2015
Scott Griepentrog has uploaded a new change for review.
https://gerrit.asterisk.org/1146
Change subject: Chaos: make hangup NULL tolerant
......................................................................
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
---
M channels/chan_pjsip.c
1 file changed, 11 insertions(+), 3 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/46/1146/1
diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c
index bb79e84..49995a2 100644
--- a/channels/chan_pjsip.c
+++ b/channels/chan_pjsip.c
@@ -1762,9 +1762,17 @@
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;
--
To view, visit https://gerrit.asterisk.org/1146
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5f47860fe9cee4cd56abd3f79b108678ab72cc87
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Scott Griepentrog <sgriepentrog at digium.com>
More information about the asterisk-code-review
mailing list