From: Scott Griepentrog Date: Thu, 16 Apr 2015 18:20:29 +0000 (-0500) Subject: res_pjsip_pubsub: On notify fail deleted sub_tree is then referenced X-Git-Tag: 14.0.0-beta1~1058^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fchanges%2F35%2F135%2F4;p=thirdparty%2Fasterisk.git 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 --- diff --git a/res/res_pjsip_pubsub.c b/res/res_pjsip_pubsub.c index e7b4b02ec6..cf649b4536 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);