diff --git a/apps/app_jack.c b/apps/app_jack.c index 2aa253f9b8..1b5f4e7382 100644 --- a/apps/app_jack.c +++ b/apps/app_jack.c @@ -977,12 +977,16 @@ static int unload_module(void) static int load_module(void) { - int res = 0; + if (ast_register_application(jack_app, jack_exec, jack_synopsis, jack_desc)) { + return AST_MODULE_LOAD_DECLINE; + } - res |= ast_register_application(jack_app, jack_exec, jack_synopsis, jack_desc); - res |= ast_custom_function_register(&jack_hook_function); + if (ast_custom_function_register(&jack_hook_function)) { + ast_unregister_application(jack_app); + return AST_MODULE_LOAD_DECLINE; + } - return res; + return AST_MODULE_LOAD_SUCCESS; } AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "JACK Interface"); diff --git a/apps/app_skel.c b/apps/app_skel.c index 061f1e87cf..588563d2fa 100644 --- a/apps/app_skel.c +++ b/apps/app_skel.c @@ -114,7 +114,8 @@ static int unload_module(void) static int load_module(void) { - return ast_register_application(app, app_exec, synopsis, descrip); + return ast_register_application(app, app_exec, synopsis, descrip) ? + AST_MODULE_LOAD_DECLINE : AST_MODULE_LOAD_SUCCESS; } AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Skeleton (sample) Application"); diff --git a/funcs/func_speex.c b/funcs/func_speex.c index f4d5fe412e..fc4eb8e3ec 100644 --- a/funcs/func_speex.c +++ b/funcs/func_speex.c @@ -336,12 +336,16 @@ static int unload_module(void) static int load_module(void) { - int res = 0; + if (ast_custom_function_register(&agc_function)) { + return AST_MODULE_LOAD_DECLINE; + } - res |= ast_custom_function_register(&agc_function); - res |= ast_custom_function_register(&denoise_function); + if (ast_custom_function_register(&denoise_function)) { + ast_custom_function_unregister(&agc_function); + return AST_MODULE_LOAD_DECLINE; + } - return res; + return AST_MODULE_LOAD_SUCCESS; } AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Noise reduction and Automatic Gain Control (AGC)");