]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-11785 [core] fix scan-build issues
authorChris Rienzo <chris@signalwire.com>
Fri, 3 May 2019 00:58:51 +0000 (00:58 +0000)
committerAndrey Volk <andywolk@gmail.com>
Wed, 17 Jul 2019 17:51:06 +0000 (21:51 +0400)
src/switch.c
src/switch_channel.c
src/switch_core.c
src/switch_core_file.c

index 4383c9546211852b0e8537a544cabefa259b7b58..6a56fd90c55458b5acdd20d0c940d490779b8ca9 100644 (file)
@@ -1240,7 +1240,7 @@ int main(int argc, char *argv[])
                int j = 0;
 
                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));
                        for (j = 0; j < argc; j++) {
                                switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%s ", argv[j]);
index 933317ad81682366cd3149965d0ea4d38d6c2ffa..4283a162315f22542666dbc66707d95ef6dc6e5f 100644 (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)) {
                bg++;
        }
index e03a041200a65a6a704cc63b3b9e5b4b1cc8f4b9..da172189745802671de015282e228314cbee10e1 100644 (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)
 {
-       FILE *handle = stdout;
-
-       switch (channel) {
-       case SWITCH_CHANNEL_ID_LOG:
-       case SWITCH_CHANNEL_ID_LOG_CLEAN:
-               handle = runtime.console;
-               break;
-       default:
-               handle = runtime.console;
-               break;
-       }
-
-       return handle;
+       return runtime.console;
 }
 
 
@@ -2880,7 +2868,7 @@ SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, void *
        case SCSC_DEBUG_LEVEL:
                if (oldintval > -1) {
                        if (oldintval > 10)
-                               newintval = 10;
+                               oldintval = 10;
                        runtime.debug_level = oldintval;
                }
                newintval = runtime.debug_level;
index ca5a3402140a895d45044042acbc1229f661e197..a009f5b19b2d18c1fe3e53d5dc2a2a6f840a91e5 100644 (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_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);
 
        if (status != SWITCH_STATUS_SUCCESS) {