[Core] Coverity fixes
* [core] coverity CID 1320751 (Dereference before null check) * [core] coverity CID 1294546 (Unchecked return value) * [core] coverity CID 1227661 (Logically dead code) * [core] coverity CID 1227656 (Logically dead code) * [core] coverity CID 1060948 (Explicit null dereferenced) * [core] coverity CID 1346465 (Unchecked return value) * [core] coverity CID 1364953 (Logically dead code) * [core] coverity CID 1468210 (Dereference before null check) * [core] coverity CID 1468546 (Dereference before null check) * [core] coverity CID 1468342 (Dereference before null check)
This commit is contained in:
parent
49c1c35982
commit
73ea37c5ab
|
@ -6672,10 +6672,6 @@ SWITCH_DECLARE(void) switch_core_session_write_blank_video(switch_core_session_t
|
||||||
if (!height) height = 288;
|
if (!height) height = 288;
|
||||||
if (!fps) fps = 15;
|
if (!fps) fps = 15;
|
||||||
|
|
||||||
if (!(width && height && fps)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
fr.packet = buf;
|
fr.packet = buf;
|
||||||
fr.packetlen = buflen;
|
fr.packetlen = buflen;
|
||||||
fr.data = buf + 12;
|
fr.data = buf + 12;
|
||||||
|
@ -12439,7 +12435,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_media_params(switch_core_sessi
|
||||||
*val++ = '\0';
|
*val++ = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name && val) {
|
if (val) {
|
||||||
if (!strcmp(name, "aspect")) {
|
if (!strcmp(name, "aspect")) {
|
||||||
aspect = val;
|
aspect = val;
|
||||||
vid++;
|
vid++;
|
||||||
|
@ -15860,7 +15856,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
|
||||||
|
|
||||||
if (!(switch_core_codec_ready(session->write_codec) && switch_core_codec_ready(frame->codec))) goto error;
|
if (!(switch_core_codec_ready(session->write_codec) && switch_core_codec_ready(frame->codec))) goto error;
|
||||||
|
|
||||||
if ((session->write_codec && frame->codec && session->write_codec->implementation != frame->codec->implementation)) {
|
if (frame->codec && session->write_codec->implementation != frame->codec->implementation) {
|
||||||
if (session->write_impl.codec_id == frame->codec->implementation->codec_id ||
|
if (session->write_impl.codec_id == frame->codec->implementation->codec_id ||
|
||||||
session->write_impl.microseconds_per_packet != frame->codec->implementation->microseconds_per_packet) {
|
session->write_impl.microseconds_per_packet != frame->codec->implementation->microseconds_per_packet) {
|
||||||
ptime_mismatch = TRUE;
|
ptime_mismatch = TRUE;
|
||||||
|
|
|
@ -2130,7 +2130,7 @@ static switch_bool_t eavesdrop_callback(switch_media_bug_t *bug, void *user_data
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ep->eavesdropper && switch_core_session_read_lock(ep->eavesdropper) == SWITCH_STATUS_SUCCESS) {
|
if (switch_core_session_read_lock(ep->eavesdropper) == SWITCH_STATUS_SUCCESS) {
|
||||||
if (switch_core_session_write_video_frame(ep->eavesdropper, bug->video_ping_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) {
|
if (switch_core_session_write_video_frame(ep->eavesdropper, bug->video_ping_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error writing video to %s\n", switch_core_session_get_name(ep->eavesdropper));
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error writing video to %s\n", switch_core_session_get_name(ep->eavesdropper));
|
||||||
ep->errs++;
|
ep->errs++;
|
||||||
|
@ -2178,10 +2178,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_pop_eavesdropper(switch_cor
|
||||||
struct eavesdrop_pvt *ep = (struct eavesdrop_pvt *) switch_core_media_bug_get_user_data(bug);
|
struct eavesdrop_pvt *ep = (struct eavesdrop_pvt *) switch_core_media_bug_get_user_data(bug);
|
||||||
|
|
||||||
if (ep && ep->eavesdropper && ep->eavesdropper != session) {
|
if (ep && ep->eavesdropper && ep->eavesdropper != session) {
|
||||||
switch_core_session_read_lock(ep->eavesdropper);
|
if (switch_core_session_read_lock(ep->eavesdropper) == SWITCH_STATUS_SUCCESS) {
|
||||||
*sessionp = ep->eavesdropper;
|
*sessionp = ep->eavesdropper;
|
||||||
switch_core_media_bug_set_flag(bug, SMBF_PRUNE);
|
switch_core_media_bug_set_flag(bug, SMBF_PRUNE);
|
||||||
status = SWITCH_STATUS_SUCCESS;
|
status = SWITCH_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -237,7 +237,7 @@ static void video_bridge_thread(switch_core_session_t *session, void *obj)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (switch_channel_media_up(b_channel)) {
|
if (read_frame && switch_channel_media_up(b_channel)) {
|
||||||
if (switch_core_session_write_video_frame(vh->session_b, read_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) {
|
if (switch_core_session_write_video_frame(vh->session_b, read_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) {
|
||||||
switch_cond_next();
|
switch_cond_next();
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -506,7 +506,7 @@ static switch_status_t switch_nat_add_mapping_upnp(switch_port_t port, switch_na
|
||||||
|
|
||||||
if (r == UPNPCOMMAND_SUCCESS) {
|
if (r == UPNPCOMMAND_SUCCESS) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "mapped public port %s protocol %s to localport %s\n", port_str,
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "mapped public port %s protocol %s to localport %s\n", port_str,
|
||||||
(proto == SWITCH_NAT_TCP) ? "TCP" : (proto == SWITCH_NAT_UDP ? "UDP" : "UNKNOWN"), port_str);
|
(proto == SWITCH_NAT_TCP) ? "TCP" : "UDP", port_str);
|
||||||
status = SWITCH_STATUS_SUCCESS;
|
status = SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -566,7 +566,7 @@ static switch_status_t switch_nat_del_mapping_upnp(switch_port_t port, switch_na
|
||||||
|
|
||||||
if (r == UPNPCOMMAND_SUCCESS) {
|
if (r == UPNPCOMMAND_SUCCESS) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "unmapped public port %s protocol %s to localport %s\n", port_str,
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "unmapped public port %s protocol %s to localport %s\n", port_str,
|
||||||
(proto == SWITCH_NAT_TCP) ? "TCP" : (proto == SWITCH_NAT_UDP ? "UDP" : "UNKNOWN"), port_str);
|
(proto == SWITCH_NAT_TCP) ? "TCP" : "UDP", port_str);
|
||||||
status = SWITCH_STATUS_SUCCESS;
|
status = SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
|
|
|
@ -1277,7 +1277,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (ice->ice_params && ice->ice_params->cands[ice->ice_params->chosen[ice->proto]][ice->proto].cand_type &&
|
if (ice->ice_params->cands[ice->ice_params->chosen[ice->proto]][ice->proto].cand_type &&
|
||||||
!strcasecmp(ice->ice_params->cands[ice->ice_params->chosen[ice->proto]][ice->proto].cand_type, "relay")) {
|
!strcasecmp(ice->ice_params->cands[ice->ice_params->chosen[ice->proto]][ice->proto].cand_type, "relay")) {
|
||||||
do_adj++;
|
do_adj++;
|
||||||
}
|
}
|
||||||
|
@ -3010,7 +3010,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_set_remote_address(switch_rtp_t *rtp_
|
||||||
rtp_session->dtls->sock_output = rtp_session->sock_output;
|
rtp_session->dtls->sock_output = rtp_session->sock_output;
|
||||||
|
|
||||||
if (rtp_session->flags[SWITCH_RTP_FLAG_RTCP_MUX]) {
|
if (rtp_session->flags[SWITCH_RTP_FLAG_RTCP_MUX]) {
|
||||||
switch_sockaddr_info_get(&rtp_session->dtls->remote_addr, host, SWITCH_UNSPEC, port, 0, rtp_session->pool);
|
status = switch_sockaddr_info_get(&rtp_session->dtls->remote_addr, host, SWITCH_UNSPEC, port, 0, rtp_session->pool);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue