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

libavformat/rtsp.c:474:17: Unknown value from: non-const function
472.                 url_close(rtsp_st->rtp_handle);
473.             if (rtsp_st->dynamic_handler && rtsp_st->dynamic_protocol_context)
474.                 rtsp_st->dynamic_handler->close(
                     ^
475.                     rtsp_st->dynamic_protocol_context);
476.         }

libavformat/rtsp.c:480:9: Call
478.     av_free(rt->rtsp_streams);
479.     if (rt->asf_ctx) {
480.         av_close_input_stream (rt->asf_ctx);
             ^
481.         rt->asf_ctx = NULL;
482.     }

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_stream` 
  2467.         av_free(st);
  2468.     }
  2469.     for(i=s->nb_programs-1; i>=0; i--) {
                ^
  2470. #if LAVF_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 LAVF_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 LAVF_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 LAVF_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);
}
['void ff_rtsp_close_streams(AVFormatContext *s)\n{\n    RTSPState *rt = s->priv_data;\n    int i;\n    RTSPStream *rtsp_st;\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->transport_priv) {\n                if (s->oformat) {\n                    AVFormatContext *rtpctx = rtsp_st->transport_priv;\n                    av_write_trailer(rtpctx);\n                    if (rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP) {\n                        uint8_t *ptr;\n                        url_close_dyn_buf(rtpctx->pb, &ptr);\n                        av_free(ptr);\n                    } else {\n                        url_fclose(rtpctx->pb);\n                    }\n                    av_metadata_free(&rtpctx->streams[0]->metadata);\n                    av_metadata_free(&rtpctx->metadata);\n                    av_free(rtpctx->streams[0]);\n                    av_free(rtpctx);\n                } else if (rt->transport == RTSP_TRANSPORT_RDT)\n                    ff_rdt_parse_close(rtsp_st->transport_priv);\n                else\n                    rtp_parse_close(rtsp_st->transport_priv);\n            }\n            if (rtsp_st->rtp_handle)\n                url_close(rtsp_st->rtp_handle);\n            if (rtsp_st->dynamic_handler && rtsp_st->dynamic_protocol_context)\n                rtsp_st->dynamic_handler->close(\n                    rtsp_st->dynamic_protocol_context);\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}', '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 LAVF_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 LAVF_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 LAVF_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}']