Browse Source

TT#108003 fix errors reported by coverity

Change-Id: I6641da426f1e05f0d0e3924887baf7fb948fb0c9
pull/1285/head
Richard Fuchs 5 years ago
parent
commit
05ef61c0d7
5 changed files with 18 additions and 5 deletions
  1. +6
    -2
      daemon/cli.c
  2. +8
    -0
      daemon/main.c
  3. +1
    -0
      daemon/media_socket.c
  4. +2
    -2
      daemon/recording.c
  5. +1
    -1
      daemon/ssrc.c

+ 6
- 2
daemon/cli.c View File

@ -375,6 +375,8 @@ static void cli_incoming_diff_or_revert(struct cli_writer *cw, char* option) {
int_diff_print(common.log_levels[log_level_index_ ## system], "log-level-" #system); int_diff_print(common.log_levels[log_level_index_ ## system], "log-level-" #system);
#include "loglevels.h" #include "loglevels.h"
#undef ll #undef ll
rwlock_lock_w(&rtpe_config.config_lock);
int_diff_print(max_sessions, "max-sessions"); int_diff_print(max_sessions, "max-sessions");
int_diff_print(cpu_limit, "max-cpu"); int_diff_print(cpu_limit, "max-cpu");
int_diff_print(load_limit, "max-load"); int_diff_print(load_limit, "max-load");
@ -387,6 +389,7 @@ static void cli_incoming_diff_or_revert(struct cli_writer *cw, char* option) {
int_diff_print(redis_disable_time, "redis_disable_time"); int_diff_print(redis_disable_time, "redis_disable_time");
int_diff_print(redis_cmd_timeout, "redis_cmd_timeout"); int_diff_print(redis_cmd_timeout, "redis_cmd_timeout");
int_diff_print(redis_connect_timeout, "redis_connect_timeout-db"); int_diff_print(redis_connect_timeout, "redis_connect_timeout-db");
rwlock_unlock_w(&rtpe_config.config_lock);
} }
static void cli_incoming_params_diff(str *instr, struct cli_writer *cw) { static void cli_incoming_params_diff(str *instr, struct cli_writer *cw) {
@ -1096,8 +1099,9 @@ static void cli_incoming_debug(str *instr, struct cli_writer *cw) {
return; return;
} }
str callid = STR_NULL;
str_token_sep(&callid, instr, ' ');
str callid;
if (str_token_sep(&callid, instr, ' '))
callid = STR_NULL;
if (!callid.len) { if (!callid.len) {
cw->cw_printf(cw, "No call ID specified\n"); cw->cw_printf(cw, "No call ID specified\n");


+ 8
- 0
daemon/main.c View File

@ -396,6 +396,8 @@ static void options(int *argc, char ***argv) {
AUTO_CLEANUP_GVBUF(cn_payload); AUTO_CLEANUP_GVBUF(cn_payload);
int debug_srtp = 0; int debug_srtp = 0;
rwlock_lock_w(&rtpe_config.config_lock);
GOptionEntry e[] = { GOptionEntry e[] = {
{ "table", 't', 0, G_OPTION_ARG_INT, &rtpe_config.kernel_table, "Kernel table to use", "INT" }, { "table", 't', 0, G_OPTION_ARG_INT, &rtpe_config.kernel_table, "Kernel table to use", "INT" },
{ "no-fallback",'F', 0, G_OPTION_ARG_NONE, &rtpe_config.no_fallback, "Only start when kernel module is available", NULL }, { "no-fallback",'F', 0, G_OPTION_ARG_NONE, &rtpe_config.no_fallback, "Only start when kernel module is available", NULL },
@ -749,6 +751,8 @@ static void options(int *argc, char ***argv) {
if (!rtpe_config.software_id) if (!rtpe_config.software_id)
rtpe_config.software_id = g_strdup_printf("rtpengine-%s", RTPENGINE_VERSION); rtpe_config.software_id = g_strdup_printf("rtpengine-%s", RTPENGINE_VERSION);
g_strcanon(rtpe_config.software_id, "QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm1234567890-", '-'); g_strcanon(rtpe_config.software_id, "QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm1234567890-", '-');
rwlock_unlock_w(&rtpe_config.config_lock);
} }
void fill_initial_rtpe_cfg(struct rtpengine_config* ini_rtpe_cfg) { void fill_initial_rtpe_cfg(struct rtpengine_config* ini_rtpe_cfg) {
@ -756,6 +760,8 @@ void fill_initial_rtpe_cfg(struct rtpengine_config* ini_rtpe_cfg) {
GList* l; GList* l;
struct intf_config* gptr_data; struct intf_config* gptr_data;
rwlock_lock_w(&rtpe_config.config_lock);
for(l = rtpe_config.interfaces.head; l ; l=l->next) { for(l = rtpe_config.interfaces.head; l ; l=l->next) {
gptr_data = g_slice_alloc0(sizeof(*gptr_data)); gptr_data = g_slice_alloc0(sizeof(*gptr_data));
memcpy(gptr_data, (struct intf_config*)(l->data), sizeof(*gptr_data)); memcpy(gptr_data, (struct intf_config*)(l->data), sizeof(*gptr_data));
@ -826,6 +832,8 @@ void fill_initial_rtpe_cfg(struct rtpengine_config* ini_rtpe_cfg) {
ini_rtpe_cfg->jb_length = rtpe_config.jb_length; ini_rtpe_cfg->jb_length = rtpe_config.jb_length;
ini_rtpe_cfg->jb_clock_drift = rtpe_config.jb_clock_drift; ini_rtpe_cfg->jb_clock_drift = rtpe_config.jb_clock_drift;
rwlock_unlock_w(&rtpe_config.config_lock);
} }
static void static void


+ 1
- 0
daemon/media_socket.c View File

@ -1496,6 +1496,7 @@ static void __stream_ssrc(struct packet_stream *in_srtp, struct packet_stream *o
// reverse SSRC mapping // reverse SSRC mapping
(*ssrc_out_p)->ssrc_map_out = in_ssrc; (*ssrc_out_p)->ssrc_map_out = in_ssrc;
// coverity[missing_lock : FALSE]
phc->unkernelize = 1; phc->unkernelize = 1;
ilog(LOG_DEBUG, ">>> out_ssrc changed for %s%s:%d new: %x %s", ilog(LOG_DEBUG, ">>> out_ssrc changed for %s%s:%d new: %x %s",
FMT_M(sockaddr_print_buf(&out_srtp->endpoint.address), out_srtp->endpoint.port, out_ssrc)); FMT_M(sockaddr_print_buf(&out_srtp->endpoint.address), out_srtp->endpoint.port, out_ssrc));


+ 2
- 2
daemon/recording.c View File

@ -460,13 +460,13 @@ static int rec_pcap_meta_finish_file(struct call *call) {
struct timeval *terminate; struct timeval *terminate;
terminate = &(((struct call_monologue *)call->monologues.head->data)->terminated); terminate = &(((struct call_monologue *)call->monologues.head->data)->terminated);
fprintf(recording->u.pcap.meta_fp, "\nTimestamp terminated ms(first monologue): %.3lf", terminate->tv_sec*1000.0 + terminate->tv_usec/1000.0); fprintf(recording->u.pcap.meta_fp, "\nTimestamp terminated ms(first monologue): %.3lf", terminate->tv_sec*1000.0 + terminate->tv_usec/1000.0);
if (localtime_r(&start, &timeinfo) < 0) {
if (localtime_r(&start, &timeinfo) == NULL) {
ilog(LOG_ERROR, "Cannot get start local time, while cleaning up recording meta file: %s", strerror(errno)); ilog(LOG_ERROR, "Cannot get start local time, while cleaning up recording meta file: %s", strerror(errno));
} else { } else {
strftime(timebuffer, 20, "%FT%T", &timeinfo); strftime(timebuffer, 20, "%FT%T", &timeinfo);
fprintf(recording->u.pcap.meta_fp, "\n\ncall start time: %s\n", timebuffer); fprintf(recording->u.pcap.meta_fp, "\n\ncall start time: %s\n", timebuffer);
} }
if (localtime_r(&end, &timeinfo) < 0) {
if (localtime_r(&end, &timeinfo) == NULL) {
ilog(LOG_ERROR, "Cannot get end local time, while cleaning up recording meta file: %s", strerror(errno)); ilog(LOG_ERROR, "Cannot get end local time, while cleaning up recording meta file: %s", strerror(errno));
} else { } else {
strftime(timebuffer, 20, "%FT%T", &timeinfo); strftime(timebuffer, 20, "%FT%T", &timeinfo);


+ 1
- 1
daemon/ssrc.c View File

@ -358,7 +358,7 @@ void ssrc_receiver_report(struct call_media *m, const struct ssrc_receiver_repor
long long rtt_end2end = other_e->last_rtt ? (rtt + other_e->last_rtt) : 0; long long rtt_end2end = other_e->last_rtt ? (rtt + other_e->last_rtt) : 0;
if (other_e->last_rtt_xr > 0) { // use the RTT from RTCP-XR (in ms) if (other_e->last_rtt_xr > 0) { // use the RTT from RTCP-XR (in ms)
rtt_end2end = other_e->last_rtt_xr*1000;
rtt_end2end = (long long) other_e->last_rtt_xr * 1000LL;
} }
struct ssrc_stats_block *ssb = g_slice_alloc(sizeof(*ssb)); struct ssrc_stats_block *ssb = g_slice_alloc(sizeof(*ssb));
*ssb = (struct ssrc_stats_block) { *ssb = (struct ssrc_stats_block) {


Loading…
Cancel
Save