[asterisk-commits] mmichelson: branch 1.4 r103904 - /branches/1.4/channels/chan_local.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Feb 20 15:40:09 CST 2008


Author: mmichelson
Date: Wed Feb 20 15:40:08 2008
New Revision: 103904

URL: http://svn.digium.com/view/asterisk?view=rev&rev=103904
Log:
Fix a crash if the channel becomes NULL while attempting to lock it.

(closes issue #12039)
Reported by: danpwi


Modified:
    branches/1.4/channels/chan_local.c

Modified: branches/1.4/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_local.c?view=diff&rev=103904&r1=103903&r2=103904
==============================================================================
--- branches/1.4/channels/chan_local.c (original)
+++ branches/1.4/channels/chan_local.c Wed Feb 20 15:40:08 2008
@@ -503,13 +503,15 @@
 		const char *status = pbx_builtin_getvar_helper(p->chan, "DIALSTATUS");
 		if ((status) && (p->owner)) {
 			/* Deadlock avoidance */
-			while (ast_channel_trylock(p->owner)) {
+			while (p->owner && ast_channel_trylock(p->owner)) {
 				ast_mutex_unlock(&p->lock);
 				usleep(1);
 				ast_mutex_lock(&p->lock);
 			}
-			pbx_builtin_setvar_helper(p->owner, "CHANLOCALSTATUS", status);
-			ast_channel_unlock(p->owner);
+			if (p->owner) {
+				pbx_builtin_setvar_helper(p->owner, "CHANLOCALSTATUS", status);
+				ast_channel_unlock(p->owner);
+			}
 		}
 		p->chan = NULL;
 		ast_clear_flag(p, LOCAL_LAUNCHED_PBX);




More information about the asterisk-commits mailing list