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

libavformat/utils.c:2542:1: start of procedure avformat_close_input()
2540. }
2541. 
2542. void avformat_close_input(AVFormatContext **ps)
      ^
2543. {
2544.     AVFormatContext *s = *ps;

libavformat/utils.c:2544:5: 
2542. void avformat_close_input(AVFormatContext **ps)
2543. {
2544.     AVFormatContext *s = *ps;
          ^
2545.     AVIOContext *pb = s->pb;
2546. 

libavformat/utils.c:2545:5: 
2543. {
2544.     AVFormatContext *s = *ps;
2545.     AVIOContext *pb = s->pb;
          ^
2546. 
2547.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||

libavformat/utils.c:2547:10: Taking true branch
2545.     AVIOContext *pb = s->pb;
2546. 
2547.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
               ^
2548.         (s->flags & AVFMT_FLAG_CUSTOM_IO))
2549.         pb = NULL;

libavformat/utils.c:2547:24: Taking false branch
2545.     AVIOContext *pb = s->pb;
2546. 
2547.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
                             ^
2548.         (s->flags & AVFMT_FLAG_CUSTOM_IO))
2549.         pb = NULL;

libavformat/utils.c:2548:10: Taking true branch
2546. 
2547.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
2548.         (s->flags & AVFMT_FLAG_CUSTOM_IO))
               ^
2549.         pb = NULL;
2550. 

libavformat/utils.c:2549:9: 
2547.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
2548.         (s->flags & AVFMT_FLAG_CUSTOM_IO))
2549.         pb = NULL;
              ^
2550. 
2551.     flush_packet_queue(s);

libavformat/utils.c:2551:5: Skipping flush_packet_queue(): empty list of specs
2549.         pb = NULL;
2550. 
2551.     flush_packet_queue(s);
          ^
2552. 
2553.     if (s->iformat) {

libavformat/utils.c:2553:9: Taking true branch
2551.     flush_packet_queue(s);
2552. 
2553.     if (s->iformat) {
              ^
2554.         if (s->iformat->read_close)
2555.             s->iformat->read_close(s);

libavformat/utils.c:2554:13: Taking true branch
2552. 
2553.     if (s->iformat) {
2554.         if (s->iformat->read_close)
                  ^
2555.             s->iformat->read_close(s);
2556.     }

libavformat/utils.c:2555:13: Skipping __function_pointer__(): unresolved function pointer
2553.     if (s->iformat) {
2554.         if (s->iformat->read_close)
2555.             s->iformat->read_close(s);
                  ^
2556.     }
2557. 

libavformat/utils.c:2558:5: Skipping avformat_free_context(): empty list of specs
2556.     }
2557. 
2558.     avformat_free_context(s);
          ^
2559. 
2560.     *ps = NULL;

libavformat/utils.c:2560:5: 
2558.     avformat_free_context(s);
2559. 
2560.     *ps = NULL;
          ^
2561. 
2562.     avio_close(pb);

libavformat/utils.c:2562:5: 
2560.     *ps = NULL;
2561. 
2562.     avio_close(pb);
          ^
2563. }
2564. 

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,
