libavformat/segment.c:349: error: Integer Overflow L1
  ([-oo, 0] - 1):unsigned32 by call to `avformat_free_context`.

libavformat/segment.c:336:15: Call
334.         close_null_ctx(oc->pb);
335.     } else {
336.         ret = segment_end(oc, 1);
                   ^
337.     }
338. 

libavformat/segment.c:147:1: Parameter `*oc->packet_buffer->next`
  145. }
  146. 
  147. static int segment_end(AVFormatContext *oc, int write_trailer)
       ^
  148. {
  149.     int ret = 0;

libavformat/segment.c:153:9: Call
  151.     av_write_frame(oc, NULL); /* Flush any buffered data (fragmented mp4) */
  152.     if (write_trailer)
  153.         av_write_trailer(oc);
               ^
  154.     avio_close(oc->pb);
  155. 

libavformat/mux.c:565:1: Parameter `*s->packet_buffer->next`
    563. }
    564. 
    565. int av_write_trailer(AVFormatContext *s)
         ^
    566. {
    567.     int ret, i;

libavformat/mux.c:571:15: Call
    569.     for (;; ) {
    570.         AVPacket pkt;
    571.         ret = interleave_packet(s, &pkt, NULL, 1);
                       ^
    572.         if (ret < 0) //FIXME cleanup needed for ret<0 ?
    573.             goto fail;

libavformat/mux.c:513:1: Parameter `*s->packet_buffer->next`
      511.  *         < 0 if an error occurred
      512.  */
      513. static int interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *in, int flush)
           ^
      514. {
      515.     if (s->oformat->interleave_packet) {

libavformat/segment.c:348:5: Call
346. 
347. fail:
348.     avio_close(seg->pb);
         ^
349.     avformat_free_context(oc);
350.     return ret;

libavformat/aviobuf.c:757:1: Parameter `s->opaque->is_connected`
  755. }
  756. 
  757. int avio_close(AVIOContext *s)
       ^
  758. {
  759.     URLContext *h;

libavformat/segment.c:349:5: Call
347. fail:
348.     avio_close(seg->pb);
349.     avformat_free_context(oc);
         ^
350.     return ret;
351. }

libavformat/utils.c:2623:1: <LHS trace>
2621. }
2622. 
2623. void avformat_free_context(AVFormatContext *s)
      ^
2624. {
2625.     int i;

libavformat/utils.c:2623:1: Parameter `s->nb_chapters`
  2621. }
  2622. 
  2623. void avformat_free_context(AVFormatContext *s)
        ^
  2624. {
  2625.     int i;

libavformat/utils.c:2656:11: Binary operation: ([-oo, 0] - 1):unsigned32 by call to `avformat_free_context` 
  2654.     av_freep(&s->programs);
  2655.     av_freep(&s->priv_data);
  2656.     while(s->nb_chapters--) {
                  ^
  2657.         av_dict_free(&s->chapters[s->nb_chapters]->metadata);
  2658.         av_free(s->chapters[s->nb_chapters]);
