diff options
author | murf <murf@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-04-22 22:04:51 +0000 |
---|---|---|
committer | murf <murf@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-04-22 22:04:51 +0000 |
commit | 5a3ed5146cc371fd61b5b90bc09c80a6a9da5468 (patch) | |
tree | 1c4401363e03e35db82b692b0a6e5961ee6825ff /main | |
parent | 81a943c2bf74a9b381cc2acb6f201b47131262fe (diff) |
Merged revisions 114553 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r114553 | murf | 2008-04-22 15:57:57 -0600 (Tue, 22 Apr 2008) | 14 lines
(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.
........
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@114556 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r-- | main/pbx.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/main/pbx.c b/main/pbx.c index a2d27b45f..aa08e96b5 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -6226,11 +6226,12 @@ static int add_pri(struct ast_context *con, struct ast_exten *tmp, 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); @@ -6249,10 +6250,12 @@ static int add_pri(struct ast_context *con, struct ast_exten *tmp, 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) |