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

libavformat/utils.c:2499:1: start of procedure avformat_close_input()
2497. }
2498. 
2499. void avformat_close_input(AVFormatContext **ps)
      ^
2500. {
2501.     AVFormatContext *s = *ps;

libavformat/utils.c:2501:5: 
2499. void avformat_close_input(AVFormatContext **ps)
2500. {
2501.     AVFormatContext *s = *ps;
          ^
2502.     AVIOContext *pb    = s->pb;
2503. 

libavformat/utils.c:2502:5: 
2500. {
2501.     AVFormatContext *s = *ps;
2502.     AVIOContext *pb    = s->pb;
          ^
2503. 
2504.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||

libavformat/utils.c:2504:10: Taking true branch
2502.     AVIOContext *pb    = s->pb;
2503. 
2504.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
               ^
2505.         (s->flags & AVFMT_FLAG_CUSTOM_IO))
2506.         pb = NULL;

libavformat/utils.c:2504:24: Taking false branch
2502.     AVIOContext *pb    = s->pb;
2503. 
2504.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
                             ^
2505.         (s->flags & AVFMT_FLAG_CUSTOM_IO))
2506.         pb = NULL;

libavformat/utils.c:2505:10: Taking true branch
2503. 
2504.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
2505.         (s->flags & AVFMT_FLAG_CUSTOM_IO))
               ^
2506.         pb = NULL;
2507. 

libavformat/utils.c:2506:9: 
2504.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
2505.         (s->flags & AVFMT_FLAG_CUSTOM_IO))
2506.         pb = NULL;
              ^
2507. 
2508.     flush_packet_queue(s);

libavformat/utils.c:2508:5: 
2506.         pb = NULL;
2507. 
2508.     flush_packet_queue(s);
          ^
2509. 
2510.     if (s->iformat)

libavformat/utils.c:1038:1: start of procedure flush_packet_queue()
  1036. 
  1037. /* XXX: suppress the packet queue */
  1038. static void flush_packet_queue(AVFormatContext *s)
        ^
  1039. {
  1040.     free_packet_buffer(&s->internal->parse_queue,       &s->internal->parse_queue_end);

libavformat/utils.c:1040:5: Skipping free_packet_buffer(): empty list of specs
  1038. static void flush_packet_queue(AVFormatContext *s)
  1039. {
  1040.     free_packet_buffer(&s->internal->parse_queue,       &s->internal->parse_queue_end);
            ^
  1041.     free_packet_buffer(&s->internal->packet_buffer,     &s->internal->packet_buffer_end);
  1042.     free_packet_buffer(&s->internal->raw_packet_buffer, &s->internal->raw_packet_buffer_end);

libavformat/utils.c:1041:5: Skipping free_packet_buffer(): empty list of specs
  1039. {
  1040.     free_packet_buffer(&s->internal->parse_queue,       &s->internal->parse_queue_end);
  1041.     free_packet_buffer(&s->internal->packet_buffer,     &s->internal->packet_buffer_end);
            ^
  1042.     free_packet_buffer(&s->internal->raw_packet_buffer, &s->internal->raw_packet_buffer_end);
  1043. 

libavformat/utils.c:1042:5: Skipping free_packet_buffer(): empty list of specs
  1040.     free_packet_buffer(&s->internal->parse_queue,       &s->internal->parse_queue_end);
  1041.     free_packet_buffer(&s->internal->packet_buffer,     &s->internal->packet_buffer_end);
  1042.     free_packet_buffer(&s->internal->raw_packet_buffer, &s->internal->raw_packet_buffer_end);
            ^
  1043. 
  1044.     s->internal->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE;

libavformat/utils.c:1044:5: 
  1042.     free_packet_buffer(&s->internal->raw_packet_buffer, &s->internal->raw_packet_buffer_end);
  1043. 
  1044.     s->internal->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE;
            ^
  1045. }
  1046. 

libavformat/utils.c:1045:1: return from a call to flush_packet_queue
  1043. 
  1044.     s->internal->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE;
  1045. }
        ^
  1046. 
  1047. /*******************************************************/

libavformat/utils.c:2510:9: Taking true branch
2508.     flush_packet_queue(s);
2509. 
2510.     if (s->iformat)
              ^
2511.         if (s->iformat->read_close)
2512.             s->iformat->read_close(s);

libavformat/utils.c:2511:13: Taking true branch
2509. 
2510.     if (s->iformat)
2511.         if (s->iformat->read_close)
                  ^
2512.             s->iformat->read_close(s);
2513. 

libavformat/utils.c:2512:13: Skipping __function_pointer__(): unresolved function pointer
2510.     if (s->iformat)
2511.         if (s->iformat->read_close)
2512.             s->iformat->read_close(s);
                  ^
2513. 
2514.     avformat_free_context(s);

libavformat/utils.c:2514:5: Skipping avformat_free_context(): empty list of specs
2512.             s->iformat->read_close(s);
2513. 
2514.     avformat_free_context(s);
          ^
2515. 
2516.     *ps = NULL;

libavformat/utils.c:2516:5: 
2514.     avformat_free_context(s);
2515. 
2516.     *ps = NULL;
          ^
2517. 
2518.     avio_close(pb);

libavformat/utils.c:2518:5: 
2516.     *ps = NULL;
2517. 
2518.     avio_close(pb);
          ^
2519. }
2520. 

libavformat/aviobuf.c:816:1: start of procedure avio_close()
  814. }
  815. 
  816. int avio_close(AVIOContext *s)
       ^
  817. {
  818.     URLContext *h;

libavformat/aviobuf.c:820:10: Taking false branch
  818.     URLContext *h;
  819. 
  820.     if (!s)
                ^
  821.         return 0;
  822. 

libavformat/aviobuf.c:823:5: 
  821.         return 0;
  822. 
  823.     avio_flush(s);
           ^
  824.     h = s->opaque;
  825.     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,
