]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_pjsip_pubsub: On notify fail deleted sub_tree is then referenced 25/1125/2
authorScott Griepentrog <scott@griepentrog.com>
Thu, 16 Apr 2015 18:20:29 +0000 (13:20 -0500)
committerMark Michelson <mmichelson@digium.com>
Fri, 21 Aug 2015 18:05:07 +0000 (13:05 -0500)
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
(cherry picked from commit 8d4ce7cc2b87317005588e700b278a8cca7005c8)

res/res_pjsip_pubsub.c

index 3eb0eeb03205b5c1b482da0b44688734f11d31e4..24c15540d1b8339087cd2436f45cf9cf7549687a 100644 (file)
@@ -2607,11 +2607,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);