[mod_sofia] Coverity fixes
[mod_sofia] coverity CID 1024253 (Dereference before null check) [mod_sofia] coverity CID 1024254 (Dereference before null check) [mod_sofia] coverity CID 1257620 (Logically dead code) [mod_sofia] coverity CID 1024750 (Dereference null return value)
This commit is contained in:
parent
645b610e79
commit
9b20b324f5
|
@ -472,7 +472,7 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
|
||||||
switch_core_hash_delete_locked(tech_pvt->profile->chat_hash, tech_pvt->hash_key, tech_pvt->profile->flag_mutex);
|
switch_core_hash_delete_locked(tech_pvt->profile->chat_hash, tech_pvt->hash_key, tech_pvt->profile->flag_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (session && tech_pvt->profile->pres_type) {
|
if (tech_pvt->profile->pres_type) {
|
||||||
char *sql = switch_mprintf("delete from sip_dialogs where uuid='%q'", switch_core_session_get_uuid(session));
|
char *sql = switch_mprintf("delete from sip_dialogs where uuid='%q'", switch_core_session_get_uuid(session));
|
||||||
switch_assert(sql);
|
switch_assert(sql);
|
||||||
sofia_glue_execute_sql_now(tech_pvt->profile, &sql, SWITCH_TRUE);
|
sofia_glue_execute_sql_now(tech_pvt->profile, &sql, SWITCH_TRUE);
|
||||||
|
@ -2205,11 +2205,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||||
argv[i], (double)((double)(MAX_REDIR + 1 - i))/1000);
|
argv[i], (double)((double)(MAX_REDIR + 1 - i))/1000);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (i == argc - 1) {
|
switch_snprintf(newdest + strlen(newdest), len - strlen(newdest), "\"unknown\" <%s>", argv[i]);
|
||||||
switch_snprintf(newdest + strlen(newdest), len - strlen(newdest), "\"unknown\" <%s>", argv[i]);
|
|
||||||
} else {
|
|
||||||
switch_snprintf(newdest + strlen(newdest), len - strlen(newdest), "\"unknown\" <%s>,", argv[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (i == argc - 1) {
|
if (i == argc - 1) {
|
||||||
|
@ -4313,6 +4309,8 @@ SWITCH_STANDARD_API(sofia_presence_data_function)
|
||||||
user = argv[1];
|
user = argv[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!user) goto end;
|
||||||
|
|
||||||
if ((domain = strchr(user, '@'))) {
|
if ((domain = strchr(user, '@'))) {
|
||||||
*domain++ = '\0';
|
*domain++ = '\0';
|
||||||
if ((concat = strchr(domain, '/'))) {
|
if ((concat = strchr(domain, '/'))) {
|
||||||
|
@ -4329,8 +4327,6 @@ SWITCH_STANDARD_API(sofia_presence_data_function)
|
||||||
domain = dup_domain;
|
domain = dup_domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!user) goto end;
|
|
||||||
|
|
||||||
if (zstr(profile_name) || strcmp(profile_name, "*") || zstr(domain)) {
|
if (zstr(profile_name) || strcmp(profile_name, "*") || zstr(domain)) {
|
||||||
if (!zstr(profile_name)) {
|
if (!zstr(profile_name)) {
|
||||||
profile = sofia_glue_find_profile(profile_name);
|
profile = sofia_glue_find_profile(profile_name);
|
||||||
|
|
|
@ -2818,7 +2818,10 @@ void event_handler(switch_event_t *event)
|
||||||
|
|
||||||
if ((sptr = strstr(fixed_contact_str, needle))) {
|
if ((sptr = strstr(fixed_contact_str, needle))) {
|
||||||
char *origsptr = strstr(contact_str, needle);
|
char *origsptr = strstr(contact_str, needle);
|
||||||
eptr = strchr(++origsptr, ';');
|
|
||||||
|
if (origsptr) {
|
||||||
|
eptr = strchr(++origsptr, ';');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
sptr = strchr(fixed_contact_str, '\0') - 1;
|
sptr = strchr(fixed_contact_str, '\0') - 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2282,8 +2282,7 @@ int sofia_recover_callback(switch_core_session_t *session)
|
||||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||||
private_object_t *tech_pvt = NULL;
|
private_object_t *tech_pvt = NULL;
|
||||||
sofia_profile_t *profile = NULL;
|
sofia_profile_t *profile = NULL;
|
||||||
const char *tmp;
|
const char *tmp, *rr, *use_uuid;
|
||||||
const char *rr;
|
|
||||||
int r = 0;
|
int r = 0;
|
||||||
const char *profile_name = switch_channel_get_variable_dup(channel, "recovery_profile_name", SWITCH_FALSE, -1);
|
const char *profile_name = switch_channel_get_variable_dup(channel, "recovery_profile_name", SWITCH_FALSE, -1);
|
||||||
int swap = switch_channel_var_true(channel, "dlg_req_swap_direction");
|
int swap = switch_channel_var_true(channel, "dlg_req_swap_direction");
|
||||||
|
@ -2374,17 +2373,13 @@ int sofia_recover_callback(switch_core_session_t *session)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (session) {
|
if ((use_uuid = switch_channel_get_variable(channel, "origination_uuid"))) {
|
||||||
const char *use_uuid;
|
if (switch_core_session_set_uuid(session, use_uuid) == SWITCH_STATUS_SUCCESS) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s set UUID=%s\n", switch_channel_get_name(channel),
|
||||||
if ((use_uuid = switch_channel_get_variable(channel, "origination_uuid"))) {
|
use_uuid);
|
||||||
if (switch_core_session_set_uuid(session, use_uuid) == SWITCH_STATUS_SUCCESS) {
|
} else {
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s set UUID=%s\n", switch_channel_get_name(channel),
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "%s set UUID=%s FAILED\n",
|
||||||
use_uuid);
|
switch_channel_get_name(channel), use_uuid);
|
||||||
} else {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "%s set UUID=%s FAILED\n",
|
|
||||||
switch_channel_get_name(channel), use_uuid);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue