libavformat/utils.c:2699: error: Null Dereference
  pointer `pb` last assigned on line 2686 could be null and is dereferenced by call to `avio_close()` at line 2699, column 5.

libavformat/utils.c:2679:1: start of procedure avformat_close_input()
2677. }
2678. 
2679. void avformat_close_input(AVFormatContext **ps)
      ^
2680. {
2681.     AVFormatContext *s = *ps;

libavformat/utils.c:2681:5: 
2679. void avformat_close_input(AVFormatContext **ps)
2680. {
2681.     AVFormatContext *s = *ps;
          ^
2682.     AVIOContext *pb = s->pb;
2683. 

libavformat/utils.c:2682:5: 
2680. {
2681.     AVFormatContext *s = *ps;
2682.     AVIOContext *pb = s->pb;
          ^
2683. 
2684.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||

libavformat/utils.c:2684:10: Taking true branch
2682.     AVIOContext *pb = s->pb;
2683. 
2684.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
               ^
2685.         (s->flags & AVFMT_FLAG_CUSTOM_IO))
2686.         pb = NULL;

libavformat/utils.c:2684:24: Taking false branch
2682.     AVIOContext *pb = s->pb;
2683. 
2684.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
                             ^
2685.         (s->flags & AVFMT_FLAG_CUSTOM_IO))
2686.         pb = NULL;

libavformat/utils.c:2685:10: Taking true branch
2683. 
2684.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
2685.         (s->flags & AVFMT_FLAG_CUSTOM_IO))
               ^
2686.         pb = NULL;
2687. 

libavformat/utils.c:2686:9: 
2684.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
2685.         (s->flags & AVFMT_FLAG_CUSTOM_IO))
2686.         pb = NULL;
              ^
2687. 
2688.     flush_packet_queue(s);

libavformat/utils.c:2688:5: Skipping flush_packet_queue(): empty list of specs
2686.         pb = NULL;
2687. 
2688.     flush_packet_queue(s);
          ^
2689. 
2690.     if (s->iformat) {

libavformat/utils.c:2690:9: Taking true branch
2688.     flush_packet_queue(s);
2689. 
2690.     if (s->iformat) {
              ^
2691.         if (s->iformat->read_close)
2692.             s->iformat->read_close(s);

libavformat/utils.c:2691:13: Taking true branch
2689. 
2690.     if (s->iformat) {
2691.         if (s->iformat->read_close)
                  ^
2692.             s->iformat->read_close(s);
2693.     }

libavformat/utils.c:2692:13: Skipping __function_pointer__(): unresolved function pointer
2690.     if (s->iformat) {
2691.         if (s->iformat->read_close)
2692.             s->iformat->read_close(s);
                  ^
2693.     }
2694. 

libavformat/utils.c:2695:5: Skipping avformat_free_context(): empty list of specs
2693.     }
2694. 
2695.     avformat_free_context(s);
          ^
2696. 
2697.     *ps = NULL;

libavformat/utils.c:2697:5: 
2695.     avformat_free_context(s);
2696. 
2697.     *ps = NULL;
          ^
2698. 
2699.     avio_close(pb);

libavformat/utils.c:2699:5: 
2697.     *ps = NULL;
2698. 
2699.     avio_close(pb);
          ^
2700. }
2701. 

libavformat/aviobuf.c:782:1: start of procedure avio_close()
  780. }
  781. 
  782. int avio_close(AVIOContext *s)
       ^
  783. {
  784.     URLContext *h;

libavformat/aviobuf.c:786:10: Taking false branch
  784.     URLContext *h;
  785. 
  786.     if (!s)
                ^
  787.         return 0;
  788. 

libavformat/aviobuf.c:789:5: 
  787.         return 0;
  788. 
  789.     avio_flush(s);
           ^
  790.     h = s->opaque;
  791.     av_freep(&s->buffer);

libavformat/aviobuf.c:180:1: start of procedure avio_flush()
    178. }
    179. 
    180. void avio_flush(AVIOContext *s)
         ^
    181. {
    182.     flush_buffer(s);

libavformat/aviobuf.c:182:5: 
    180. void avio_flush(AVIOContext *s)
    181. {
    182.     flush_buffer(s);
             ^
    183.     s->must_flush = 0;
    184. }

libavformat/aviobuf.c:124:1: start of procedure flush_buffer()
      122. }
      123. 
      124. static void flush_buffer(AVIOContext *s)
           ^
      125. {
      126.     if (s->buf_ptr > s->buffer) {

libavformat/aviobuf.c:126:9: 
      124. static void flush_buffer(AVIOContext *s)
      125. {
      126.     if (s->buf_ptr > s->buffer) {
                   ^
      127.         if (s->write_packet && !s->error) {
      128.             int ret = s->write_packet(s->opaque, s->buffer,
