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

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

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:600:1: Parameter `*s->packet_buffer->next`
    598. }
    599. 
    600. int av_write_trailer(AVFormatContext *s)
         ^
    601. {
    602.     int ret, i;

libavformat/mux.c:606:15: Call
    604.     for (;; ) {
    605.         AVPacket pkt;
    606.         ret = interleave_packet(s, &pkt, NULL, 1);
                       ^
    607.         if (ret < 0) //FIXME cleanup needed for ret<0 ?
    608.             goto fail;

libavformat/mux.c:548:1: Parameter `*s->packet_buffer->next`
      546.  *         < 0 if an error occurred
      547.  */
      548. static int interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *in, int flush)
           ^
      549. {
      550.     if (s->oformat->interleave_packet) {

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

libavformat/aviobuf.c:794:1: Parameter `s->opaque->is_connected`
  792. }
  793. 
  794. int avio_close(AVIOContext *s)
       ^
  795. {
  796.     URLContext *h;

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

libavformat/utils.c:2595:1: <LHS trace>
2593. }
2594. 
2595. void avformat_free_context(AVFormatContext *s)
      ^
2596. {
2597.     int i;

libavformat/utils.c:2595:1: Parameter `s->nb_chapters`
  2593. }
  2594. 
  2595. void avformat_free_context(AVFormatContext *s)
        ^
  2596. {
  2597.     int i;

libavformat/utils.c:2629:12: Binary operation: ([-oo, 0] - 1):unsigned32 by call to `avformat_free_context` 
  2627.     av_freep(&s->programs);
  2628.     av_freep(&s->priv_data);
  2629.     while (s->nb_chapters--) {
                   ^
  2630.         av_dict_free(&s->chapters[s->nb_chapters]->metadata);
  2631.         av_free(s->chapters[s->nb_chapters]);
