Fixed invalid memory access when adding extension to pattern match tree
authorMatthew Jordan <mjordan@digium.com>
Mon, 31 Oct 2011 16:10:32 +0000 (16:10 +0000)
committerMatthew Jordan <mjordan@digium.com>
Mon, 31 Oct 2011 16:10:32 +0000 (16:10 +0000)
commit9333071c1f6639095b033a797f3cf2b7a4fc445a
treea20ae585f183037cbf93dc09a6741512cac1e633
parent4b826c46b320cb0002083fc81c158286df1a0f35
Fixed invalid memory access when adding extension to pattern match tree

When an extension is removed from a context, its entry in the pattern match
tree is not deleted.  Instead, the extension is marked as deleted.  When an
extension is removed and re-added, if that extension is also a prefix of
another extension, several log messages would report an error and did not
check whether or not the extension was deleted before accessing the memory.
Additionally, if the extension was already in the tree but previously
deleted, and the pattern was at the end of a match, the findonly flag was
not honored and the extension would be erroneously undeleted.

Additionaly, it was discovered that an IAX2 peer could be unregistered
via the CLI, while at the same time it could be scheduled for unregistration
by Asterisk.  The unregistration method now checks to see if the peer
was already unregistered before continuing with an unregistration.

(closes issue ASTERISK-18135)
Reported by: Jaco Kroon, Henry Fernandes, Kristijan Vrban
Tested by: Matt Jordan

Review: https://reviewboard.asterisk.org/r/1526
........

Merged revisions 342769 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 342770 from http://svn.asterisk.org/svn/asterisk/branches/10

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@342771 65c4cc65-6c06-0410-ace0-fbb531ad65f3
channels/chan_iax2.c
main/pbx.c