]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[mod_av] Fix scan-build 14 2447/head
authorJakub Karolczyk <jakub.karolczyk@signalwire.com>
Fri, 26 Apr 2024 12:41:07 +0000 (12:41 +0000)
committerJakub Karolczyk <jakub.karolczyk@signalwire.com>
Fri, 26 Apr 2024 12:41:07 +0000 (12:41 +0000)
src/mod/applications/mod_av/avcodec.c
src/mod/applications/mod_av/avformat.c

index 16d268273b2c6c835b585ab92723f424aeaf0e49..4f0057264e25dbd49db6ed8d3532892a32b50288 100644 (file)
@@ -1581,7 +1581,6 @@ GCC_DIAG_ON(deprecated-declarations)
        } else if (ret == AVERROR(EAGAIN)) {
                /* we fully drain all the output in each encode call, so this should not ever happen */
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "Error sending frame to encoder - BUG, should never happen\n");
-               ret = AVERROR_BUG;
                goto error;
        } else if (ret < 0) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error sending frame to encoder\n");
index 69475c169f9cba1985e3befac4fe4c34fe4eb6b8..c1e00525300162297ad05677089756bd746345da 100644 (file)
@@ -1170,7 +1170,6 @@ GCC_DIAG_ON(deprecated-declarations)
        } else if (ret == AVERROR(EAGAIN)) {
                /* we fully drain all the output in each encode call, so this should not ever happen */
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "Error sending frame to encoder on draining AVERROR_BUG - should never happen\n");
-               ret = AVERROR_BUG;
                goto do_break;
        } else if (ret < 0) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "Error sending frame to encoder on draining\n");
@@ -1426,7 +1425,7 @@ static switch_status_t open_input_file(av_file_context_t *context, switch_file_h
 
        av_dump_format(context->fc, 0, filename, 0);
 
-       for (i = 0; i< context->fc->nb_streams; i++) {
+       for (i = 0; i < context->fc->nb_streams; i++) {
                enum AVMediaType codec_type = av_get_codec_type(context->fc->streams[i]);
 
                if (codec_type == AVMEDIA_TYPE_AUDIO && context->has_audio < 2 && idx < 2) {
@@ -1554,7 +1553,9 @@ static switch_status_t open_input_file(av_file_context_t *context, switch_file_h
        if (context->has_audio) {
                AVCodecContext *c[2] = { NULL };
 
-               c[0] = av_get_codec_context(&context->audio_st[0]);
+               if (!(c[0] = av_get_codec_context(&context->audio_st[0]))) {
+                       switch_goto_status(SWITCH_STATUS_FALSE, err);
+               }
 
                if ((cc = av_get_codec_context(&context->audio_st[1]))) {
                        c[1] = cc;
@@ -1568,9 +1569,7 @@ static switch_status_t open_input_file(av_file_context_t *context, switch_file_h
                if (c[1]) {
                        context->audio_st[1].frame = av_frame_alloc();
                        switch_assert(context->audio_st[1].frame);
-               }
 
-               if (c[0] && c[1]) {
                        context->audio_st[0].channels = 1;
                        context->audio_st[1].channels = 1;
                } else {
@@ -2016,7 +2015,6 @@ GCC_DIAG_ON(deprecated-declarations)
                        } else if (dret == AVERROR(EAGAIN)) {
                                /* we fully drain all the output in each decode call, so this should not ever happen */
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "Error sending audio packet to decoder - BUG, should never happen\n");
-                               dret = AVERROR_BUG;
                                goto do_continue;
                        } else if (dret < 0) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "Error sending audio packet to decoder\n");