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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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,
