[asterisk-commits] jrose: branch 1.8 r310733 - /branches/1.8/main/channel.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Mar 14 16:30:27 CDT 2011


Author: jrose
Date: Mon Mar 14 16:30:25 2011
New Revision: 310733

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=310733
Log:
Undoes 310726 for further analysis

Modified:
    branches/1.8/main/channel.c

Modified: branches/1.8/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/channel.c?view=diff&rev=310733&r1=310732&r2=310733
==============================================================================
--- branches/1.8/main/channel.c (original)
+++ branches/1.8/main/channel.c Mon Mar 14 16:30:25 2011
@@ -2313,6 +2313,7 @@
 	struct ast_var_t *vardata;
 	struct ast_frame *f;
 	struct varshead *headp;
+	struct ast_datastore *datastore;
 	char device_name[AST_CHANNEL_NAME];
 
 	if (chan->name) {
@@ -2320,6 +2321,18 @@
 		ast_cel_report_event(chan, AST_CEL_CHANNEL_END, NULL, NULL, NULL);
 		ast_cel_check_retire_linkedid(chan);
 	}
+
+	/* Get rid of each of the data stores on the channel */
+	ast_channel_lock(chan);
+	while ((datastore = AST_LIST_REMOVE_HEAD(&chan->datastores, entry)))
+		/* Free the data store */
+		ast_datastore_free(datastore);
+	ast_channel_unlock(chan);
+
+	/* Lock and unlock the channel just to be sure nobody has it locked still
+	   due to a reference that was stored in a datastore. (i.e. app_chanspy) */
+	ast_channel_lock(chan);
+	ast_channel_unlock(chan);
 
 	if (chan->tech_pvt) {
 		ast_log(LOG_WARNING, "Channel '%s' may not have been hung up properly\n", chan->name);
@@ -2671,7 +2684,6 @@
 {
 	int res = 0;
 	char extra_str[64]; /* used for cel logging below */
-	struct ast_datastore *datastore;
 
 	/* Don't actually hang up a channel that will masquerade as someone else, or
 	   if someone is going to masquerade as us */
@@ -2777,15 +2789,6 @@
 		chan->cdr = NULL;
 		ast_channel_unlock(chan);
 	}
-
-	/* Get rid of each of the data stores on the channel */
-	ast_channel_lock(chan);
-	while ((datastore = AST_LIST_REMOVE_HEAD(&chan->datastores, entry))) {
-		/* Free the data store */
-		ast_datastore_free(datastore);
-	}
-	ast_channel_unlock(chan);
-
 
 	chan = ast_channel_release(chan);
 




More information about the asterisk-commits mailing list