FS-11785 [core] fix scan-build issues

This commit is contained in:
Chris Rienzo 2019-05-03 00:58:51 +00:00 committed by Andrey Volk
parent bc6fe22a0b
commit 239bf913f4
4 changed files with 6 additions and 15 deletions

View File

@ -1240,7 +1240,7 @@ int main(int argc, char *argv[])
int j = 0; int j = 0;
switch_sleep(1000000); switch_sleep(1000000);
if (!argv || execv(argv[0], argv) == -1) { if (!argv || !argv[0] || execv(argv[0], argv) == -1) {
fprintf(stderr, "Restart Failed [%s] resorting to plan b\n", strerror(errno)); fprintf(stderr, "Restart Failed [%s] resorting to plan b\n", strerror(errno));
for (j = 0; j < argc; j++) { for (j = 0; j < argc; j++) {
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%s ", argv[j]); switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%s ", argv[j]);

View File

@ -3679,6 +3679,7 @@ static void do_execute_on(switch_channel_t *channel, const char *variable)
} }
} }
switch_assert(app != NULL);
if (!strncasecmp(app, "perl", 4)) { if (!strncasecmp(app, "perl", 4)) {
bg++; bg++;
} }

View File

@ -270,19 +270,7 @@ SWITCH_DECLARE(void) switch_core_screen_size(int *x, int *y)
SWITCH_DECLARE(FILE *) switch_core_data_channel(switch_text_channel_t channel) SWITCH_DECLARE(FILE *) switch_core_data_channel(switch_text_channel_t channel)
{ {
FILE *handle = stdout; return runtime.console;
switch (channel) {
case SWITCH_CHANNEL_ID_LOG:
case SWITCH_CHANNEL_ID_LOG_CLEAN:
handle = runtime.console;
break;
default:
handle = runtime.console;
break;
}
return handle;
} }
@ -2880,7 +2868,7 @@ SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, void *
case SCSC_DEBUG_LEVEL: case SCSC_DEBUG_LEVEL:
if (oldintval > -1) { if (oldintval > -1) {
if (oldintval > 10) if (oldintval > 10)
newintval = 10; oldintval = 10;
runtime.debug_level = oldintval; runtime.debug_level = oldintval;
} }
newintval = runtime.debug_level; newintval = runtime.debug_level;

View File

@ -43,6 +43,8 @@ static switch_status_t get_file_size(switch_file_handle_t *fh, const char **stri
switch_file_t *newfile; switch_file_t *newfile;
switch_size_t size = 0; switch_size_t size = 0;
switch_assert(string);
status = switch_file_open(&newfile, fh->spool_path ? fh->spool_path : fh->file_path, SWITCH_FOPEN_READ, SWITCH_FPROT_OS_DEFAULT, fh->memory_pool); status = switch_file_open(&newfile, fh->spool_path ? fh->spool_path : fh->file_path, SWITCH_FOPEN_READ, SWITCH_FPROT_OS_DEFAULT, fh->memory_pool);
if (status != SWITCH_STATUS_SUCCESS) { if (status != SWITCH_STATUS_SUCCESS) {