]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-11903: Fix errors reported by PVS-Studio Static Code Analyzer for mod_shout
authorAndrey Volk <andywolk@gmail.com>
Fri, 12 Jul 2019 16:11:33 +0000 (20:11 +0400)
committerAndrey Volk <andywolk@gmail.com>
Mon, 15 Jul 2019 19:40:52 +0000 (23:40 +0400)
src/mod/formats/mod_shout/mod_shout.c

index 99ea75770025c4eb8192b286bc894fd9b2672a67..c317aebc70a700dd2f9e4bb63939693b7c94e4c4 100644 (file)
@@ -1249,6 +1249,7 @@ void do_telecast(switch_stream_handle_t *stream)
        switch_core_session_t *tsession;
        char *fname = "stream.mp3";
 
+       switch_assert(uuid);
        if ((fname = strchr(uuid, '/'))) {
                *fname++ = '\0';
        }
@@ -1309,14 +1310,14 @@ void do_telecast(switch_stream_handle_t *stream)
                                switch_buffer_lock(buffer);
                                bytes = switch_buffer_read(buffer, buf, sizeof(buf));
                                switch_buffer_unlock(buffer);
-                       } else {
-                               if (!bytes) {
-                                       switch_cond_next();
-                                       continue;
-                               }
-                               memset(buf, 0, bytes);
                        }
 
+                       if (!bytes) {
+                               switch_cond_next();
+                               continue;
+                       }
+                       memset(buf, 0, bytes);
+
                        if ((rlen = lame_encode_buffer(gfp, (void *) buf, NULL, (int)(bytes / 2), mp3buf, sizeof(mp3buf))) < 0) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MP3 encode error %d!\n", rlen);
                                goto end;