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

libavformat/utils.c:2647:1: start of procedure avformat_close_input()
2645. }
2646. 
2647. void avformat_close_input(AVFormatContext **ps)
      ^
2648. {
2649.     AVFormatContext *s = *ps;

libavformat/utils.c:2649:5: 
2647. void avformat_close_input(AVFormatContext **ps)
2648. {
2649.     AVFormatContext *s = *ps;
          ^
2650.     AVIOContext *pb    = s->pb;
2651. 

libavformat/utils.c:2650:5: 
2648. {
2649.     AVFormatContext *s = *ps;
2650.     AVIOContext *pb    = s->pb;
          ^
2651. 
2652.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||

libavformat/utils.c:2652:10: Taking true branch
2650.     AVIOContext *pb    = s->pb;
2651. 
2652.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
               ^
2653.         (s->flags & AVFMT_FLAG_CUSTOM_IO))
2654.         pb = NULL;

libavformat/utils.c:2652:24: Taking false branch
2650.     AVIOContext *pb    = s->pb;
2651. 
2652.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
                             ^
2653.         (s->flags & AVFMT_FLAG_CUSTOM_IO))
2654.         pb = NULL;

libavformat/utils.c:2653:10: Taking true branch
2651. 
2652.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
2653.         (s->flags & AVFMT_FLAG_CUSTOM_IO))
               ^
2654.         pb = NULL;
2655. 

libavformat/utils.c:2654:9: 
2652.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
2653.         (s->flags & AVFMT_FLAG_CUSTOM_IO))
2654.         pb = NULL;
              ^
2655. 
2656.     flush_packet_queue(s);

libavformat/utils.c:2656:5: Skipping flush_packet_queue(): empty list of specs
2654.         pb = NULL;
2655. 
2656.     flush_packet_queue(s);
          ^
2657. 
2658.     if (s->iformat)

libavformat/utils.c:2658:9: Taking true branch
2656.     flush_packet_queue(s);
2657. 
2658.     if (s->iformat)
              ^
2659.         if (s->iformat->read_close)
2660.             s->iformat->read_close(s);

libavformat/utils.c:2659:13: Taking true branch
2657. 
2658.     if (s->iformat)
2659.         if (s->iformat->read_close)
                  ^
2660.             s->iformat->read_close(s);
2661. 

libavformat/utils.c:2660:13: Skipping __function_pointer__(): unresolved function pointer
2658.     if (s->iformat)
2659.         if (s->iformat->read_close)
2660.             s->iformat->read_close(s);
                  ^
2661. 
2662.     avformat_free_context(s);

libavformat/utils.c:2662:5: Skipping avformat_free_context(): empty list of specs
2660.             s->iformat->read_close(s);
2661. 
2662.     avformat_free_context(s);
          ^
2663. 
2664.     *ps = NULL;

libavformat/utils.c:2664:5: 
2662.     avformat_free_context(s);
2663. 
2664.     *ps = NULL;
          ^
2665. 
2666.     avio_close(pb);

libavformat/utils.c:2666:5: 
2664.     *ps = NULL;
2665. 
2666.     avio_close(pb);
          ^
2667. }
2668. 

libavformat/aviobuf.c:794:1: start of procedure avio_close()
  792. }
  793. 
  794. int avio_close(AVIOContext *s)
       ^
  795. {
  796.     URLContext *h;

libavformat/aviobuf.c:798:10: Taking false branch
  796.     URLContext *h;
  797. 
  798.     if (!s)
                ^
  799.         return 0;
  800. 

libavformat/aviobuf.c:801:5: 
  799.         return 0;
  800. 
  801.     avio_flush(s);
           ^
  802.     h = s->opaque;
  803.     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,
