diff options
author | Kinsey Moore <kmoore@digium.com> | 2014-04-07 20:41:05 +0000 |
---|---|---|
committer | Kinsey Moore <kmoore@digium.com> | 2014-04-07 20:41:05 +0000 |
commit | fcb04d889a51122ded985c18c455851ba96e48a0 (patch) | |
tree | 3e3f39333b24cbe3940b2a06d9127ff7f7c112f3 /res | |
parent | c0a812e1432aa0aeb5d913230df5ca3e1a09bdc1 (diff) |
PJSIP: Ensure test event has new state
The change that fixed the pubsub test event's use of a dangling pointer
also changed when it was processed relative to the pjsip subscription
state change processing. This change corrects the order of events while
holding a reference to the pointer that was previously dangling.
........
Merged revisions 411883 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@411884 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res')
-rw-r--r-- | res/res_pjsip_pubsub.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/res/res_pjsip_pubsub.c b/res/res_pjsip_pubsub.c index 468346024..43f00518e 100644 --- a/res/res_pjsip_pubsub.c +++ b/res/res_pjsip_pubsub.c @@ -466,16 +466,21 @@ pjsip_dialog *ast_sip_subscription_get_dlg(struct ast_sip_subscription *sub) int ast_sip_subscription_send_request(struct ast_sip_subscription *sub, pjsip_tx_data *tdata) { struct ast_sip_endpoint *endpoint = ast_sip_subscription_get_endpoint(sub); + int res; + + ao2_ref(sub, +1); + res = pjsip_evsub_send_request(ast_sip_subscription_get_evsub(sub), + tdata) == PJ_SUCCESS ? 0 : -1; ast_test_suite_event_notify("SUBSCRIPTION_STATE_SET", "StateText: %s\r\n" "Endpoint: %s\r\n", pjsip_evsub_get_state_name(ast_sip_subscription_get_evsub(sub)), ast_sorcery_object_get_id(endpoint)); + ao2_cleanup(sub); ao2_cleanup(endpoint); - return pjsip_evsub_send_request(ast_sip_subscription_get_evsub(sub), - tdata) == PJ_SUCCESS ? 0 : -1; + return res; } static void subscription_datastore_destroy(void *obj) |