[asterisk-commits] kmoore: trunk r411884 - in /trunk: ./ res/res_pjsip_pubsub.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Apr 7 15:41:09 CDT 2014


Author: kmoore
Date: Mon Apr  7 15:41:05 2014
New Revision: 411884

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=411884
Log:
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

Modified:
    trunk/   (props changed)
    trunk/res/res_pjsip_pubsub.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.

Modified: trunk/res/res_pjsip_pubsub.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_pjsip_pubsub.c?view=diff&rev=411884&r1=411883&r2=411884
==============================================================================
--- trunk/res/res_pjsip_pubsub.c (original)
+++ trunk/res/res_pjsip_pubsub.c Mon Apr  7 15:41:05 2014
@@ -466,16 +466,21 @@
 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)




More information about the asterisk-commits mailing list