[asterisk-commits] murf: trunk r114553 - /trunk/main/pbx.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 22 16:57:58 CDT 2008


Author: murf
Date: Tue Apr 22 16:57:57 2008
New Revision: 114553

URL: http://svn.digium.com/view/asterisk?view=rev&rev=114553
Log:

(closes issue #12469)
Reported by: triccyx

I had a bit a problem reproducing this in my setup (trying not to disturb my other stuff)
but finally, I got it. The problem appears to be that the extension is being added in
replace mode, which kinda assumes that the pattern trie has been formed, when in fact,
in this case, it was not. The checks being done are not nec. when the tree is not yet
formed, as changes like this will be summarized when the trie is formed in the future.

I tested the fix, and the crash no longer happens. Feel free to open the bug again if
this fix doesn't cure the problem.


Modified:
    trunk/main/pbx.c

Modified: trunk/main/pbx.c
URL: http://svn.digium.com/view/asterisk/trunk/main/pbx.c?view=diff&rev=114553&r1=114552&r2=114553
==============================================================================
--- trunk/main/pbx.c (original)
+++ trunk/main/pbx.c Tue Apr 22 16:57:57 2008
@@ -6467,11 +6467,12 @@
 			el->next = tmp;
 			/* The pattern trie points to this exten; replace the pointer,
 			   and all will be well */
-			
-			if (x->exten) { /* this test for safety purposes */
-				x->exten = tmp; /* replace what would become a bad pointer */
-			} else {
-				ast_log(LOG_ERROR,"Trying to delete an exten from a context, but the pattern tree node returned isn't an extension\n");
+			if (x) { /* if the trie isn't formed yet, don't sweat this */
+				if (x->exten) { /* this test for safety purposes */
+					x->exten = tmp; /* replace what would become a bad pointer */
+				} else {
+					ast_log(LOG_ERROR,"Trying to delete an exten from a context, but the pattern tree node returned isn't an extension\n");
+				}
 			}
 		} else {			/* We're the very first extension.  */
 			struct match_char *x = add_exten_to_pattern_tree(con, e, 1);
@@ -6490,10 +6491,12 @@
  			con->root = tmp;
 			/* The pattern trie points to this exten; replace the pointer,
 			   and all will be well */
-			if (x->exten) { /* this test for safety purposes */
-				x->exten = tmp; /* replace what would become a bad pointer */
-			} else {
-				ast_log(LOG_ERROR,"Trying to delete an exten from a context, but the pattern tree node returned isn't an extension\n");
+			if (x) { /* if the trie isn't formed yet; no problem */
+				if (x->exten) { /* this test for safety purposes */
+					x->exten = tmp; /* replace what would become a bad pointer */
+				} else {
+					ast_log(LOG_ERROR,"Trying to delete an exten from a context, but the pattern tree node returned isn't an extension\n");
+				}
 			}
 		}
 		if (tmp->priority == PRIORITY_HINT)




More information about the asterisk-commits mailing list