diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/bucket.c | 2 | ||||
-rw-r--r-- | main/codec.c | 4 | ||||
-rw-r--r-- | main/loader.c | 8 |
3 files changed, 8 insertions, 6 deletions
diff --git a/main/bucket.c b/main/bucket.c index 78a2289fd..90397f1f9 100644 --- a/main/bucket.c +++ b/main/bucket.c @@ -282,7 +282,7 @@ int __ast_bucket_scheme_register(const char *name, struct ast_sorcery_wizard *bu ast_verb(2, "Registered bucket scheme '%s'\n", name); - ast_module_ref(module); + ast_module_shutdown_ref(module); return 0; } diff --git a/main/codec.c b/main/codec.c index 19e78fa67..45f2edf2b 100644 --- a/main/codec.c +++ b/main/codec.c @@ -296,8 +296,8 @@ int __ast_codec_register(struct ast_codec *codec, struct ast_module *mod) ao2_link_flags(codecs, codec_new, OBJ_NOLOCK); - /* Once registered a codec can not be unregistered, and the module must persist */ - ast_module_ref(mod); + /* Once registered a codec can not be unregistered, and the module must persist until shutdown */ + ast_module_shutdown_ref(mod); ast_verb(2, "Registered '%s' codec '%s' at sample rate '%u' with id '%u'\n", ast_codec_media_type2str(codec->type), codec->name, codec->sample_rate, codec_new->id); diff --git a/main/loader.c b/main/loader.c index 33b6f7ece..f2f3e234a 100644 --- a/main/loader.c +++ b/main/loader.c @@ -1484,10 +1484,12 @@ struct ast_module *__ast_module_ref(struct ast_module *mod, const char *file, in void __ast_module_shutdown_ref(struct ast_module *mod, const char *file, int line, const char *func) { - if (!mod->flags.keepuntilshutdown) { - __ast_module_ref(mod, file, line, func); - mod->flags.keepuntilshutdown = 1; + if (!mod || mod->flags.keepuntilshutdown) { + return; } + + __ast_module_ref(mod, file, line, func); + mod->flags.keepuntilshutdown = 1; } void __ast_module_unref(struct ast_module *mod, const char *file, int line, const char *func) |