FS-11903: Fix errors reported by PVS-Studio Static Code Analyzer for mod_sofia

This commit is contained in:
Mariah Yang
2019-07-02 07:15:17 +04:00
committed by Andrey Volk
parent 6f9ee4216c
commit d654faa5a9
8 changed files with 171 additions and 216 deletions
+6 -6
View File
@@ -766,7 +766,7 @@ void sofia_reg_expire_call_id(sofia_profile_t *profile, const char *call_id, int
host = dup;
}
if (!host) {
if (zstr(host)) {
host = "none";
}
@@ -978,7 +978,7 @@ void sofia_reg_check_call_id(sofia_profile_t *profile, const char *call_id)
host = dup;
}
if (!host) {
if (zstr(host)) {
host = "none";
}
@@ -1614,7 +1614,7 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
( !strncasecmp(sip->sip_user_agent->g_string, "Polycom", 7) ||
!strncasecmp(sip->sip_user_agent->g_string, "KIRK Wireless Server", 20) ||
!strncasecmp(sip->sip_user_agent->g_string, "ADTRAN_Total_Access", 19) )) {
if (sip && sip->sip_via) {
if (sip->sip_via) {
const char *host = sip->sip_via->v_host;
const char *c_port = sip->sip_via->v_port;
int port = 0;
@@ -1924,7 +1924,7 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
switch_safe_free(url);
switch_safe_free(contact);
if ((is_wss || is_ws || (sofia_test_pflag(profile, PFLAG_TCP_UNREG_ON_SOCKET_CLOSE) && (is_tcp || is_tls))) && !sofia_private && call_id) {
if ((is_wss || is_ws || (sofia_test_pflag(profile, PFLAG_TCP_UNREG_ON_SOCKET_CLOSE) && (is_tcp || is_tls))) && !sofia_private) {
char key[256] = "";
nua_handle_t *hnh;
switch_snprintf(key, sizeof(key), "%s%s%s", call_id, network_ip, network_port_c);
@@ -2396,11 +2396,11 @@ void sofia_reg_handle_sip_r_register(int status,
return;
}
if (sofia_private && !zstr(sofia_private->gateway_name)) {
if (!zstr(sofia_private->gateway_name)) {
gateway = sofia_reg_find_gateway(sofia_private->gateway_name);
}
if (sofia_private && gateway) {
if (gateway) {
reg_state_t ostate = gateway->state;
char oregister_network_ip[80] = { 0 };
char network_ip[80] = { 0 };