]> git.ipfire.org Git - thirdparty/asterisk.git/commit
loader: Minor fix to module registration.
authorCorey Farrell <git@cfware.com>
Wed, 22 Nov 2017 02:34:56 +0000 (21:34 -0500)
committerCorey Farrell <git@cfware.com>
Fri, 15 Dec 2017 15:44:26 +0000 (10:44 -0500)
commit4de95d4bf0bbaf1cc47a2b907dd24cc6ca0afa6b
tree113e089ca2cb5cb075fc7af244a72b49a30f7cda
parent7377927b18118fcf5307e565daa3cb8dd819e26e
loader: Minor fix to module registration.

This protects the module loader itself against crashing if dlopen is
called on a module from outside loader.c.

* Expand scope of lock inside ast_module_register to include reading of
  resource_being_loaded.
* NULL check resource_being_loaded.
* Set resource_being_loaded NULL as soon as dlopen returns.  This fixes
  some error paths where it was not NULL'ed.
* Create module_destroy function to deduplicate code from
  ast_module_unregister and modules_shutdown.
* Resolve leak that occured if a module did not successfully register.
* Simplify checking for successful registration.

Change-Id: I40f07a315e55b92df4fc7faf525ed6d4f396e7d2
main/loader.c