libavformat/rtsp.c:536: error: Integer Overflow L2
  ([0, +oo] - 1):unsigned32 by call to `av_close_input_stream`.

libavformat/rtsp.c:529:17: Unknown value from: non-const function
527.         if (rtsp_st) {
528.             if (rtsp_st->dynamic_handler && rtsp_st->dynamic_protocol_context)
529.                 rtsp_st->dynamic_handler->free(
                     ^
530.                     rtsp_st->dynamic_protocol_context);
531.             av_free(rtsp_st);

libavformat/rtsp.c:536:9: Call
534.     av_free(rt->rtsp_streams);
535.     if (rt->asf_ctx) {
536.         av_close_input_stream (rt->asf_ctx);
             ^
537.         rt->asf_ctx = NULL;
538.     }

libavformat/utils.c:2524:1: Parameter `s->nb_programs`
  2522. }
  2523. 
  2524. void av_close_input_stream(AVFormatContext *s)
        ^
  2525. {
  2526.     flush_packet_queue(s);

libavformat/utils.c:2529:5: Call
  2527.     if (s->iformat->read_close)
  2528.         s->iformat->read_close(s);
  2529.     avformat_free_context(s);
            ^
  2530. }
  2531. 

libavformat/utils.c:2532:1: <LHS trace>
2530. }
2531. 
2532. void avformat_free_context(AVFormatContext *s)
      ^
2533. {
2534.     int i;

libavformat/utils.c:2532:1: Parameter `s->nb_programs`
    2530. }
    2531. 
    2532. void avformat_free_context(AVFormatContext *s)
          ^
    2533. {
    2534.     int i;

libavformat/utils.c:2553:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `av_close_input_stream` 
    2551.         av_free(st);
    2552.     }
    2553.     for(i=s->nb_programs-1; i>=0; i--) {
                  ^
    2554.         av_metadata_free(&s->programs[i]->metadata);
    2555.         av_freep(&s->programs[i]->stream_index);

void avformat_free_context(AVFormatContext *s)
{
    int i;
    AVStream *st;
    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->subtitle_header);
        av_free(st->codec);
        av_free(st->priv_data);
        av_free(st->info);
        av_free(st);
    }
    for(i=s->nb_programs-1; i>=0; i--) {
        av_metadata_free(&s->programs[i]->metadata);
        av_freep(&s->programs[i]->stream_index);
        av_freep(&s->programs[i]);
    }
    av_freep(&s->programs);
    av_freep(&s->priv_data);
    while(s->nb_chapters--) {
        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_freep(&s->key);
    av_freep(&s->streams);
    av_free(s);
}
['void ff_rtsp_close_streams(AVFormatContext *s)\n{\n    RTSPState *rt = s->priv_data;\n    int i;\n    RTSPStream *rtsp_st;\n    ff_rtsp_undo_setup(s);\n    for (i = 0; i < rt->nb_rtsp_streams; i++) {\n        rtsp_st = rt->rtsp_streams[i];\n        if (rtsp_st) {\n            if (rtsp_st->dynamic_handler && rtsp_st->dynamic_protocol_context)\n                rtsp_st->dynamic_handler->free(\n                    rtsp_st->dynamic_protocol_context);\n            av_free(rtsp_st);\n        }\n    }\n    av_free(rt->rtsp_streams);\n    if (rt->asf_ctx) {\n        av_close_input_stream (rt->asf_ctx);\n        rt->asf_ctx = NULL;\n    }\n    av_free(rt->p);\n    av_free(rt->recvbuf);\n}', 'void av_close_input_stream(AVFormatContext *s)\n{\n    flush_packet_queue(s);\n    if (s->iformat->read_close)\n        s->iformat->read_close(s);\n    avformat_free_context(s);\n}', 'void avformat_free_context(AVFormatContext *s)\n{\n    int i;\n    AVStream *st;\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->subtitle_header);\n        av_free(st->codec);\n        av_free(st->priv_data);\n        av_free(st->info);\n        av_free(st);\n    }\n    for(i=s->nb_programs-1; i>=0; i--) {\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    av_freep(&s->priv_data);\n    while(s->nb_chapters--) {\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_freep(&s->key);\n    av_freep(&s->streams);\n    av_free(s);\n}']