Merge pull request #2054 from dragos-oancea/mod_avmd-cov3

[mod_avmd] coverity CID 1395555 (Dereference before null check)
This commit is contained in:
Andrey Volk 2023-04-18 13:23:26 +03:00 committed by GitHub
commit dd81253ab1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 4 deletions

View File

@ -1138,6 +1138,13 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_avmd_load) {
switch_application_interface_t *app_interface;
switch_api_interface_t *api_interface;
if (pool == NULL) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No memory pool assigned!\n");
return SWITCH_STATUS_TERM;
}
/* connect my internal structure to the blank pointer passed to me */
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
@ -1147,10 +1154,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_avmd_load) {
}
memset(&avmd_globals, 0, sizeof(avmd_globals));
if (pool == NULL) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No memory pool assigned!\n");
return SWITCH_STATUS_TERM;
}
switch_mutex_init(&avmd_globals.mutex, SWITCH_MUTEX_NESTED, pool);
avmd_globals.pool = pool;