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

libavformat/utils.c:2538:1: start of procedure avformat_close_input()
2536. }
2537. 
2538. void avformat_close_input(AVFormatContext **ps)
      ^
2539. {
2540.     AVFormatContext *s = *ps;

libavformat/utils.c:2540:5: 
2538. void avformat_close_input(AVFormatContext **ps)
2539. {
2540.     AVFormatContext *s = *ps;
          ^
2541.     AVIOContext *pb = s->pb;
2542. 

libavformat/utils.c:2541:5: 
2539. {
2540.     AVFormatContext *s = *ps;
2541.     AVIOContext *pb = s->pb;
          ^
2542. 
2543.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||

libavformat/utils.c:2543:10: Taking true branch
2541.     AVIOContext *pb = s->pb;
2542. 
2543.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
               ^
2544.         (s->flags & AVFMT_FLAG_CUSTOM_IO))
2545.         pb = NULL;

libavformat/utils.c:2543:24: Taking false branch
2541.     AVIOContext *pb = s->pb;
2542. 
2543.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
                             ^
2544.         (s->flags & AVFMT_FLAG_CUSTOM_IO))
2545.         pb = NULL;

libavformat/utils.c:2544:10: Taking true branch
2542. 
2543.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
2544.         (s->flags & AVFMT_FLAG_CUSTOM_IO))
               ^
2545.         pb = NULL;
2546. 

libavformat/utils.c:2545:9: 
2543.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
2544.         (s->flags & AVFMT_FLAG_CUSTOM_IO))
2545.         pb = NULL;
              ^
2546. 
2547.     flush_packet_queue(s);

libavformat/utils.c:2547:5: Skipping flush_packet_queue(): empty list of specs
2545.         pb = NULL;
2546. 
2547.     flush_packet_queue(s);
          ^
2548. 
2549.     if (s->iformat) {

libavformat/utils.c:2549:9: Taking true branch
2547.     flush_packet_queue(s);
2548. 
2549.     if (s->iformat) {
              ^
2550.         if (s->iformat->read_close)
2551.             s->iformat->read_close(s);

libavformat/utils.c:2550:13: Taking true branch
2548. 
2549.     if (s->iformat) {
2550.         if (s->iformat->read_close)
                  ^
2551.             s->iformat->read_close(s);
2552.     }

libavformat/utils.c:2551:13: Skipping __function_pointer__(): unresolved function pointer
2549.     if (s->iformat) {
2550.         if (s->iformat->read_close)
2551.             s->iformat->read_close(s);
                  ^
2552.     }
2553. 

libavformat/utils.c:2554:5: Skipping avformat_free_context(): empty list of specs
2552.     }
2553. 
2554.     avformat_free_context(s);
          ^
2555. 
2556.     *ps = NULL;

libavformat/utils.c:2556:5: 
2554.     avformat_free_context(s);
2555. 
2556.     *ps = NULL;
          ^
2557. 
2558.     avio_close(pb);

libavformat/utils.c:2558:5: 
2556.     *ps = NULL;
2557. 
2558.     avio_close(pb);
          ^
2559. }
2560. 

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,
