res/res_phoneprov: Fix crash on shutdown caused by container cleanup
authorMatthew Jordan <mjordan@digium.com>
Mon, 27 Oct 2014 02:27:56 +0000 (02:27 +0000)
committerMatthew Jordan <mjordan@digium.com>
Mon, 27 Oct 2014 02:27:56 +0000 (02:27 +0000)
commit62bee9b327d048852ad33bce47baeeab7bb3878e
treee4b35cdda93ea8b8ba0937db46bfe238a3f7f75a
parent130a3fcd7ff7d4f253d4f2509fca9b6c752377b0
res/res_phoneprov: Fix crash on shutdown caused by container cleanup

In res_phoneprov, unloading the module first destroys the http_routes
container, followed by the users. However, users may have a route in
the http_routes container; the validity of this container is not checked
in the users destructor. Hence, we hit an assert as the container has already
been set to NULL.

This patch does two things:
(1) It adds a sanity check in the user destructor (because why not)
(2) It switches the order of destruction, so that users are disposed of prior
    to the HTTP routes they may hold a reference to.

Note that this crash was caught by the Test Suite (go go testing!)
........

Merged revisions 426174 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 426176 from http://svn.asterisk.org/svn/asterisk/branches/13

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@426179 65c4cc65-6c06-0410-ace0-fbb531ad65f3
res/res_phoneprov.c