diff options
author | Joshua Colp <jcolp@digium.com> | 2018-01-04 07:12:43 -0600 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2018-01-04 07:12:43 -0600 |
commit | 2fac32a37adbe92922212e17f2989cf1b0333832 (patch) | |
tree | bc99fa2c3a60f19f0684ae1a89eae82e611f22c6 /main/rtp_engine.c | |
parent | 25399f74aab21c47d12e5abda4df0998787d16fe (diff) | |
parent | 55f1d69c43d2c6c87eec50fd3eed7a77ba2e912b (diff) |
Merge "loader: Create ast_module_running_ref."
Diffstat (limited to 'main/rtp_engine.c')
-rw-r--r-- | main/rtp_engine.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/main/rtp_engine.c b/main/rtp_engine.c index 76bdf87b0..1c734778f 100644 --- a/main/rtp_engine.c +++ b/main/rtp_engine.c @@ -428,6 +428,7 @@ struct ast_rtp_instance *ast_rtp_instance_new(const char *engine_name, struct ast_sockaddr address = {{0,}}; struct ast_rtp_instance *instance = NULL; struct ast_rtp_engine *engine = NULL; + struct ast_module *mod_ref; AST_RWLIST_RDLOCK(&engines); @@ -450,10 +451,15 @@ struct ast_rtp_instance *ast_rtp_instance_new(const char *engine_name, } /* Bump up the reference count before we return so the module can not be unloaded */ - ast_module_ref(engine->mod); + mod_ref = ast_module_running_ref(engine->mod); AST_RWLIST_UNLOCK(&engines); + if (!mod_ref) { + /* BUGBUG: improve handling of this situation. */ + return NULL; + } + /* Allocate a new RTP instance */ if (!(instance = ao2_alloc(sizeof(*instance), instance_destructor))) { ast_module_unref(engine->mod); |