ffmpeg.c:750: error: Integer Overflow L2
  ([0, +oo] - 1):unsigned32 by call to `av_close_input_file`.

ffmpeg.c:728:17: Assignment
726.         if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
727.             if (audio_stream_copy) {
728.                 st->stream_copy = 1;
                     ^
729.             } else
730.                 choose_sample_fmt(st, codec);

ffmpeg.c:750:5: Call
748.         s->timestamp = av_gettime();
749. 
750.     av_close_input_file(ic);
         ^
751.     return 0;
752. }

libavformat/utils.c:2493:1: Parameter `s->nb_programs`
  2491. }
  2492. 
  2493. void av_close_input_file(AVFormatContext *s)
        ^
  2494. {
  2495.     ByteIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb;

libavformat/utils.c:2496:5: Call
  2494. {
  2495.     ByteIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb;
  2496.     av_close_input_stream(s);
            ^
  2497.     if (pb)
  2498.         url_fclose(pb);

libavformat/utils.c:2445:1: <LHS trace>
2443. }
2444. 
2445. void av_close_input_stream(AVFormatContext *s)
      ^
2446. {
2447.     int i;

libavformat/utils.c:2445:1: Parameter `s->nb_programs`
    2443. }
    2444. 
    2445. void av_close_input_stream(AVFormatContext *s)
          ^
    2446. {
    2447.     int i;

libavformat/utils.c:2469:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `av_close_input_file` 
    2467.         av_free(st);
    2468.     }
    2469.     for(i=s->nb_programs-1; i>=0; i--) {
                  ^
    2470. #if FF_API_OLD_METADATA
    2471.         av_freep(&s->programs[i]->provider_name);

void av_close_input_stream(AVFormatContext *s)
{
    int i;
    AVStream *st;
    if (s->iformat->read_close)
        s->iformat->read_close(s);
    for(i=0;i<s->nb_streams;i++) {
        st = s->streams[i];
        if (st->parser) {
            av_parser_close(st->parser);
            av_free_packet(&st->cur_pkt);
        }
        av_metadata_free(&st->metadata);
        av_free(st->index_entries);
        av_free(st->codec->extradata);
        av_free(st->codec);
#if FF_API_OLD_METADATA
        av_free(st->filename);
#endif
        av_free(st->priv_data);
        av_free(st);
    }
    for(i=s->nb_programs-1; i>=0; i--) {
#if FF_API_OLD_METADATA
        av_freep(&s->programs[i]->provider_name);
        av_freep(&s->programs[i]->name);
#endif
        av_metadata_free(&s->programs[i]->metadata);
        av_freep(&s->programs[i]->stream_index);
        av_freep(&s->programs[i]);
    }
    av_freep(&s->programs);
    flush_packet_queue(s);
    av_freep(&s->priv_data);
    while(s->nb_chapters--) {
#if FF_API_OLD_METADATA
        av_free(s->chapters[s->nb_chapters]->title);
#endif
        av_metadata_free(&s->chapters[s->nb_chapters]->metadata);
        av_free(s->chapters[s->nb_chapters]);
    }
    av_freep(&s->chapters);
    av_metadata_free(&s->metadata);
    av_free(s);
}
['static int read_ffserver_streams(AVFormatContext *s, const char *filename)\n{\n    int i, err;\n    AVFormatContext *ic;\n    int nopts = 0;\n    err = av_open_input_file(&ic, filename, NULL, FFM_PACKET_SIZE, NULL);\n    if (err < 0)\n        return err;\n    s->nb_streams = ic->nb_streams;\n    for(i=0;i<ic->nb_streams;i++) {\n        AVStream *st;\n        AVCodec *codec;\n        st = av_mallocz(sizeof(AVStream));\n        memcpy(st, ic->streams[i], sizeof(AVStream));\n        st->codec = avcodec_alloc_context();\n        if (!st->codec) {\n            print_error(filename, AVERROR(ENOMEM));\n            ffmpeg_exit(1);\n        }\n        avcodec_copy_context(st->codec, ic->streams[i]->codec);\n        s->streams[i] = st;\n        codec = avcodec_find_encoder(st->codec->codec_id);\n        if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {\n            if (audio_stream_copy) {\n                st->stream_copy = 1;\n            } else\n                choose_sample_fmt(st, codec);\n        } else if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {\n            if (video_stream_copy) {\n                st->stream_copy = 1;\n            } else\n                choose_pixel_fmt(st, codec);\n        }\n        if(!st->codec->thread_count)\n            st->codec->thread_count = 1;\n        if(st->codec->thread_count>1)\n            avcodec_thread_init(st->codec, st->codec->thread_count);\n        if(st->codec->flags & CODEC_FLAG_BITEXACT)\n            nopts = 1;\n    }\n    if (!nopts)\n        s->timestamp = av_gettime();\n    av_close_input_file(ic);\n    return 0;\n}', 'void av_close_input_file(AVFormatContext *s)\n{\n    ByteIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb;\n    av_close_input_stream(s);\n    if (pb)\n        url_fclose(pb);\n}', 'void av_close_input_stream(AVFormatContext *s)\n{\n    int i;\n    AVStream *st;\n    if (s->iformat->read_close)\n        s->iformat->read_close(s);\n    for(i=0;i<s->nb_streams;i++) {\n        st = s->streams[i];\n        if (st->parser) {\n            av_parser_close(st->parser);\n            av_free_packet(&st->cur_pkt);\n        }\n        av_metadata_free(&st->metadata);\n        av_free(st->index_entries);\n        av_free(st->codec->extradata);\n        av_free(st->codec);\n#if FF_API_OLD_METADATA\n        av_free(st->filename);\n#endif\n        av_free(st->priv_data);\n        av_free(st);\n    }\n    for(i=s->nb_programs-1; i>=0; i--) {\n#if FF_API_OLD_METADATA\n        av_freep(&s->programs[i]->provider_name);\n        av_freep(&s->programs[i]->name);\n#endif\n        av_metadata_free(&s->programs[i]->metadata);\n        av_freep(&s->programs[i]->stream_index);\n        av_freep(&s->programs[i]);\n    }\n    av_freep(&s->programs);\n    flush_packet_queue(s);\n    av_freep(&s->priv_data);\n    while(s->nb_chapters--) {\n#if FF_API_OLD_METADATA\n        av_free(s->chapters[s->nb_chapters]->title);\n#endif\n        av_metadata_free(&s->chapters[s->nb_chapters]->metadata);\n        av_free(s->chapters[s->nb_chapters]);\n    }\n    av_freep(&s->chapters);\n    av_metadata_free(&s->metadata);\n    av_free(s);\n}']