[Core] Coverity fixes

* [core] coverity CID 1024482 (Dereference after null check)

* [core] coverity CID 1468368 (Logically dead code)

* [core] coverity CID 1468459 (Logically dead code)

* [core] coverity CID 1232742 (Dereference before null check)
This commit is contained in:
Dragos Oancea 2023-04-18 19:30:22 +03:00 committed by GitHub
parent dbd37bdc51
commit b5cb26dc47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 5 deletions

View File

@ -147,7 +147,7 @@ static void check_ip(void)
} else if (strcmp(hostname, runtime.hostname)) {
if (switch_event_create(&event, SWITCH_EVENT_TRAP) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "condition", "hostname-change");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "old-hostname", hostname ? hostname : "nil");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "old-hostname", hostname);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "new-hostname", runtime.hostname);
switch_event_fire(&event);
}

View File

@ -160,8 +160,6 @@ SWITCH_DECLARE(switch_status_t) switch_packetizer_feed_extradata(switch_packetiz
p += 5;
left -= 5;
if (left < 0) return SWITCH_STATUS_FALSE;
//sps
n_sps = *p & 0x1f;
p += 1;

View File

@ -1353,7 +1353,6 @@ SWITCH_DECLARE(void) switch_srtp_err_to_txt(srtp_err_status_t stat, char **msg)
else if (stat == srtp_err_status_read_fail) *msg="couldn't read data";
else if (stat == srtp_err_status_write_fail) *msg="couldn't write data";
else if (stat == srtp_err_status_parse_err) *msg="error parsing data";
else if (stat == srtp_err_status_write_fail) *msg="couldn't read data";
else if (stat == srtp_err_status_encode_err) *msg="error encoding data";
else if (stat == srtp_err_status_semaphore_err) *msg="error while using semaphores";
else if (stat == srtp_err_status_pfkey_err) *msg="error while using pfkey ";
@ -4947,7 +4946,7 @@ SWITCH_DECLARE(void) switch_rtp_kill_socket(switch_rtp_t *rtp_session)
}
if (rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP]) {
if (rtp_session->rtcp_sock_input && rtp_session->rtcp_sock_input != rtp_session->sock_input) {
if (rtp_session->sock_input && rtp_session->rtcp_sock_input && rtp_session->rtcp_sock_input != rtp_session->sock_input) {
ping_socket(rtp_session);
switch_socket_shutdown(rtp_session->rtcp_sock_input, SWITCH_SHUTDOWN_READWRITE);
}