libavformat/applehttp.c:146: error: Integer Overflow L1
  ([-oo, 0] - 1):unsigned32 by call to `av_close_input_file`.

libavformat/applehttp.c:145:13: Assignment
143.             url_fclose(var->pb);
144.         if (var->ctx) {
145.             var->ctx->pb = NULL;
                 ^
146.             av_close_input_file(var->ctx);
147.         }

libavformat/applehttp.c:146:13: Call
144.         if (var->ctx) {
145.             var->ctx->pb = NULL;
146.             av_close_input_file(var->ctx);
                 ^
147.         }
148.         av_free(var);

libavformat/utils.c:2593:1: Parameter `s->nb_chapters`
  2591. }
  2592. 
  2593. void av_close_input_file(AVFormatContext *s)
        ^
  2594. {
  2595.     ByteIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb;

libavformat/utils.c:2596:5: Call
  2594. {
  2595.     ByteIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb;
  2596.     av_close_input_stream(s);
            ^
  2597.     if (pb)
  2598.         url_fclose(pb);

libavformat/utils.c:2542:1: <LHS trace>
2540. }
2541. 
2542. void av_close_input_stream(AVFormatContext *s)
      ^
2543. {
2544.     int i;

libavformat/utils.c:2542:1: Parameter `s->nb_chapters`
    2540. }
    2541. 
    2542. void av_close_input_stream(AVFormatContext *s)
          ^
    2543. {
    2544.     int i;

libavformat/utils.c:2580:11: Binary operation: ([-oo, 0] - 1):unsigned32 by call to `av_close_input_file` 
    2578.     av_freep(&s->programs);
    2579.     av_freep(&s->priv_data);
    2580.     while(s->nb_chapters--) {
                    ^
    2581. #if FF_API_OLD_METADATA
    2582.         av_free(s->chapters[s->nb_chapters]->title);

void av_close_input_stream(AVFormatContext *s)
{
    int i;
    AVStream *st;
    flush_packet_queue(s);
    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->subtitle_header);
        av_free(st->codec);
#if FF_API_OLD_METADATA
        av_free(st->filename);
#endif
        av_free(st->priv_data);
        av_free(st->info);
        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);
    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_freep(&s->key);
    av_free(s);
}
['static void free_variant_list(AppleHTTPContext *c)\n{\n    int i;\n    for (i = 0; i < c->n_variants; i++) {\n        struct variant *var = c->variants[i];\n        free_segment_list(var);\n        av_free_packet(&var->pkt);\n        if (var->pb)\n            url_fclose(var->pb);\n        if (var->ctx) {\n            var->ctx->pb = NULL;\n            av_close_input_file(var->ctx);\n        }\n        av_free(var);\n    }\n    av_freep(&c->variants);\n    c->n_variants = 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    flush_packet_queue(s);\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->subtitle_header);\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->info);\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    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_freep(&s->key);\n    av_free(s);\n}']