diff options
author | Corey Farrell <git@cfware.com> | 2017-12-29 19:24:02 -0500 |
---|---|---|
committer | Corey Farrell <git@cfware.com> | 2018-01-03 17:23:36 -0500 |
commit | 55f1d69c43d2c6c87eec50fd3eed7a77ba2e912b (patch) | |
tree | 0749060ca9d29dc796152f1654a340f091f4f600 /main/translate.c | |
parent | 7f4facc5e4a96ccae10283da998044becc4fbe11 (diff) |
loader: Create ast_module_running_ref.
This function returns NULL if the module in question is not running. I
did not change ast_module_ref as most callers do not check the result
and they always call ast_module_unref.
Make use of this function when running registered items from:
* app_stack API's
* bridge technologies
* CLI commands
* File formats
* Manager Actions
* RTP engines
* Sorcery Wizards
* Timing Interfaces
* Translators
* AGI Commands
* Fax Technologies
ASTERISK-20346 #close
Change-Id: Ia16fd28e188b2fc0b9d18b8a5d9cacc31df73fcc
Diffstat (limited to 'main/translate.c')
-rw-r--r-- | main/translate.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/main/translate.c b/main/translate.c index 02717c5ed..3d4905723 100644 --- a/main/translate.c +++ b/main/translate.c @@ -342,7 +342,10 @@ static struct ast_trans_pvt *newpvt(struct ast_translator *t, struct ast_format */ pvt->explicit_dst = ao2_bump(explicit_dst); - ast_module_ref(t->module); + if (!ast_module_running_ref(t->module)) { + ast_free(pvt); + return NULL; + } /* call local init routine, if present */ if (t->newpvt && t->newpvt(pvt)) { |