summaryrefslogtreecommitdiff
path: root/res/res_pjsip_pubsub.c
diff options
context:
space:
mode:
authorScott Griepentrog <scott@griepentrog.com>2015-04-16 13:20:29 -0500
committerScott Griepentrog <sgriepentrog@digium.com>2015-04-16 13:52:24 -0500
commit8d4ce7cc2b87317005588e700b278a8cca7005c8 (patch)
tree6b03b3eb1f14dc1d53438eaf65bc856564315cec /res/res_pjsip_pubsub.c
parent5d218cde872ed3fa2dc5ad92ed3a17b413ce8203 (diff)
res_pjsip_pubsub: On notify fail deleted sub_tree is then referenced
This change makes the send_notify of the sub_tree not happen when the sub_tree has been deleted due to the notify call failing, which avoids a crash. ASTERISK-24970 #close Change-Id: I1f20ffc08b192f59c457293b218025a693992cbf
Diffstat (limited to 'res/res_pjsip_pubsub.c')
-rw-r--r--res/res_pjsip_pubsub.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/res/res_pjsip_pubsub.c b/res/res_pjsip_pubsub.c
index 5a0f963dc..0f08a0ff4 100644
--- a/res/res_pjsip_pubsub.c
+++ b/res/res_pjsip_pubsub.c
@@ -2601,11 +2601,12 @@ static pj_bool_t pubsub_on_rx_subscribe_request(pjsip_rx_data *rdata)
sip_subscription_accept(sub_tree, rdata, resp);
if (generate_initial_notify(sub_tree->root)) {
pjsip_evsub_terminate(sub_tree->evsub, PJ_TRUE);
+ } else {
+ send_notify(sub_tree, 1);
+ ast_test_suite_event_notify("SUBSCRIPTION_ESTABLISHED",
+ "Resource: %s",
+ sub_tree->root->resource);
}
- send_notify(sub_tree, 1);
- ast_test_suite_event_notify("SUBSCRIPTION_ESTABLISHED",
- "Resource: %s",
- sub_tree->root->resource);
}
resource_tree_destroy(&tree);