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

libavformat/movenc.c:3182:9: Call
3180.     } else {
3181.         mov_flush_fragment(s);
3182.         mov_write_mfra_tag(pb, mov);
              ^
3183.     }
3184. 

libavformat/movenc.c:2420:1: Parameter `mov->tracks->nb_frag_info`
  2418. }
  2419. 
  2420. static int mov_write_mfra_tag(AVIOContext *pb, MOVMuxContext *mov)
        ^
  2421. {
  2422.     int64_t pos = avio_tell(pb);

libavformat/movenc.c:3190:13: Call
3188.     for (i=0; i<mov->nb_streams; i++) {
3189.         if (mov->tracks[i].tag == MKTAG('r','t','p',' '))
3190.             ff_mov_close_hinting(&mov->tracks[i]);
                  ^
3191.         if (mov->flags & FF_MOV_FLAG_FRAGMENT &&
3192.             mov->tracks[i].vc1_info.struct_offset && s->pb->seekable) {

libavformat/movenchint.c:448:1: Parameter `track->rtp_ctx->nb_programs`
  446. }
  447. 
  448. void ff_mov_close_hinting(MOVTrack *track) {
       ^
  449.     AVFormatContext* rtp_ctx = track->rtp_ctx;
  450.     uint8_t *ptr;

libavformat/movenchint.c:461:5: Call
  459.         av_free(ptr);
  460.     }
  461.     avformat_free_context(rtp_ctx);
           ^
  462. }

libavformat/utils.c:2546:1: <LHS trace>
2544. }
2545. 
2546. void avformat_free_context(AVFormatContext *s)
      ^
2547. {
2548.     int i;

libavformat/utils.c:2546:1: Parameter `s->nb_programs`
    2544. }
    2545. 
    2546. void avformat_free_context(AVFormatContext *s)
          ^
    2547. {
    2548.     int i;

libavformat/utils.c:2571:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `ff_mov_close_hinting` 
    2569.         av_free(st);
    2570.     }
    2571.     for(i=s->nb_programs-1; i>=0; i--) {
                  ^
    2572.         av_dict_free(&s->programs[i]->metadata);
    2573.         av_freep(&s->programs[i]->stream_index);

void avformat_free_context(AVFormatContext *s)
{
    int i;
    AVStream *st;
    av_opt_free(s);
    if (s->iformat && s->iformat->priv_class && s->priv_data)
        av_opt_free(s->priv_data);
    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_dict_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_dict_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_dict_free(&s->chapters[s->nb_chapters]->metadata);
        av_free(s->chapters[s->nb_chapters]);
    }
    av_freep(&s->chapters);
    av_dict_free(&s->metadata);
    av_freep(&s->streams);
    av_free(s);
}
['static int mov_write_trailer(AVFormatContext *s)\n{\n    MOVMuxContext *mov = s->priv_data;\n    AVIOContext *pb = s->pb;\n    int res = 0;\n    int i;\n    int64_t moov_pos = avio_tell(pb);\n    if (!(mov->flags & FF_MOV_FLAG_FRAGMENT)) {\n        if (mov->mdat_size + 8 <= UINT32_MAX) {\n            avio_seek(pb, mov->mdat_pos, SEEK_SET);\n            avio_wb32(pb, mov->mdat_size + 8);\n        } else {\n            avio_seek(pb, mov->mdat_pos - 8, SEEK_SET);\n            avio_wb32(pb, 1);\n            ffio_wfourcc(pb, "mdat");\n            avio_wb64(pb, mov->mdat_size + 16);\n        }\n        avio_seek(pb, moov_pos, SEEK_SET);\n        mov_write_moov_tag(pb, mov, s);\n    } else {\n        mov_flush_fragment(s);\n        mov_write_mfra_tag(pb, mov);\n    }\n    if (mov->chapter_track)\n        av_freep(&mov->tracks[mov->chapter_track].enc);\n    for (i=0; i<mov->nb_streams; i++) {\n        if (mov->tracks[i].tag == MKTAG(\'r\',\'t\',\'p\',\' \'))\n            ff_mov_close_hinting(&mov->tracks[i]);\n        if (mov->flags & FF_MOV_FLAG_FRAGMENT &&\n            mov->tracks[i].vc1_info.struct_offset && s->pb->seekable) {\n            int64_t off = avio_tell(pb);\n            uint8_t buf[7];\n            if (mov_write_dvc1_structs(&mov->tracks[i], buf) >= 0) {\n                avio_seek(pb, mov->tracks[i].vc1_info.struct_offset, SEEK_SET);\n                avio_write(pb, buf, 7);\n                avio_seek(pb, off, SEEK_SET);\n            }\n        }\n        av_freep(&mov->tracks[i].cluster);\n        av_freep(&mov->tracks[i].frag_info);\n        if (mov->tracks[i].vos_len)\n            av_free(mov->tracks[i].vos_data);\n    }\n    avio_flush(pb);\n    av_freep(&mov->tracks);\n    return res;\n}', 'static int mov_write_mfra_tag(AVIOContext *pb, MOVMuxContext *mov)\n{\n    int64_t pos = avio_tell(pb);\n    int i;\n    avio_wb32(pb, 0);\n    ffio_wfourcc(pb, "mfra");\n    if (mov->flags & FF_MOV_FLAG_ISML)\n        return update_size(pb, pos);\n    for (i = 0; i < mov->nb_streams; i++) {\n        MOVTrack *track = &mov->tracks[i];\n        if (track->nb_frag_info)\n            mov_write_tfra_tag(pb, track);\n    }\n    avio_wb32(pb, 16);\n    ffio_wfourcc(pb, "mfro");\n    avio_wb32(pb, 0);\n    avio_wb32(pb, avio_tell(pb) + 4 - pos);\n    return update_size(pb, pos);\n}', 'void ff_mov_close_hinting(MOVTrack *track) {\n    AVFormatContext* rtp_ctx = track->rtp_ctx;\n    uint8_t *ptr;\n    av_freep(&track->enc);\n    sample_queue_free(&track->sample_queue);\n    if (!rtp_ctx)\n        return;\n    if (rtp_ctx->pb) {\n        av_write_trailer(rtp_ctx);\n        avio_close_dyn_buf(rtp_ctx->pb, &ptr);\n        av_free(ptr);\n    }\n    avformat_free_context(rtp_ctx);\n}', 'void avformat_free_context(AVFormatContext *s)\n{\n    int i;\n    AVStream *st;\n    av_opt_free(s);\n    if (s->iformat && s->iformat->priv_class && s->priv_data)\n        av_opt_free(s->priv_data);\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_dict_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_dict_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_dict_free(&s->chapters[s->nb_chapters]->metadata);\n        av_free(s->chapters[s->nb_chapters]);\n    }\n    av_freep(&s->chapters);\n    av_dict_free(&s->metadata);\n    av_freep(&s->streams);\n    av_free(s);\n}']