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

libavformat/utils.c:2630:1: start of procedure avformat_close_input()
2628. }
2629. 
2630. void avformat_close_input(AVFormatContext **ps)
      ^
2631. {
2632.     AVFormatContext *s = *ps;

libavformat/utils.c:2632:5: 
2630. void avformat_close_input(AVFormatContext **ps)
2631. {
2632.     AVFormatContext *s = *ps;
          ^
2633.     AVIOContext *pb    = s->pb;
2634. 

libavformat/utils.c:2633:5: 
2631. {
2632.     AVFormatContext *s = *ps;
2633.     AVIOContext *pb    = s->pb;
          ^
2634. 
2635.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||

libavformat/utils.c:2635:10: Taking true branch
2633.     AVIOContext *pb    = s->pb;
2634. 
2635.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
               ^
2636.         (s->flags & AVFMT_FLAG_CUSTOM_IO))
2637.         pb = NULL;

libavformat/utils.c:2635:24: Taking false branch
2633.     AVIOContext *pb    = s->pb;
2634. 
2635.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
                             ^
2636.         (s->flags & AVFMT_FLAG_CUSTOM_IO))
2637.         pb = NULL;

libavformat/utils.c:2636:10: Taking true branch
2634. 
2635.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
2636.         (s->flags & AVFMT_FLAG_CUSTOM_IO))
               ^
2637.         pb = NULL;
2638. 

libavformat/utils.c:2637:9: 
2635.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
2636.         (s->flags & AVFMT_FLAG_CUSTOM_IO))
2637.         pb = NULL;
              ^
2638. 
2639.     flush_packet_queue(s);

libavformat/utils.c:2639:5: 
2637.         pb = NULL;
2638. 
2639.     flush_packet_queue(s);
          ^
2640. 
2641.     if (s->iformat)

libavformat/utils.c:1077:1: start of procedure flush_packet_queue()
  1075. 
  1076. /* XXX: suppress the packet queue */
  1077. static void flush_packet_queue(AVFormatContext *s)
        ^
  1078. {
  1079.     free_packet_buffer(&s->internal->parse_queue,       &s->internal->parse_queue_end);

libavformat/utils.c:1079:5: Skipping free_packet_buffer(): empty list of specs
  1077. static void flush_packet_queue(AVFormatContext *s)
  1078. {
  1079.     free_packet_buffer(&s->internal->parse_queue,       &s->internal->parse_queue_end);
            ^
  1080.     free_packet_buffer(&s->internal->packet_buffer,     &s->internal->packet_buffer_end);
  1081.     free_packet_buffer(&s->internal->raw_packet_buffer, &s->internal->raw_packet_buffer_end);

libavformat/utils.c:1080:5: Skipping free_packet_buffer(): empty list of specs
  1078. {
  1079.     free_packet_buffer(&s->internal->parse_queue,       &s->internal->parse_queue_end);
  1080.     free_packet_buffer(&s->internal->packet_buffer,     &s->internal->packet_buffer_end);
            ^
  1081.     free_packet_buffer(&s->internal->raw_packet_buffer, &s->internal->raw_packet_buffer_end);
  1082. 

libavformat/utils.c:1081:5: Skipping free_packet_buffer(): empty list of specs
  1079.     free_packet_buffer(&s->internal->parse_queue,       &s->internal->parse_queue_end);
  1080.     free_packet_buffer(&s->internal->packet_buffer,     &s->internal->packet_buffer_end);
  1081.     free_packet_buffer(&s->internal->raw_packet_buffer, &s->internal->raw_packet_buffer_end);
            ^
  1082. 
  1083.     s->internal->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE;

libavformat/utils.c:1083:5: 
  1081.     free_packet_buffer(&s->internal->raw_packet_buffer, &s->internal->raw_packet_buffer_end);
  1082. 
  1083.     s->internal->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE;
            ^
  1084. }
  1085. 

libavformat/utils.c:1084:1: return from a call to flush_packet_queue
  1082. 
  1083.     s->internal->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE;
  1084. }
        ^
  1085. 
  1086. /*******************************************************/

libavformat/utils.c:2641:9: Taking true branch
2639.     flush_packet_queue(s);
2640. 
2641.     if (s->iformat)
              ^
2642.         if (s->iformat->read_close)
2643.             s->iformat->read_close(s);

libavformat/utils.c:2642:13: Taking true branch
2640. 
2641.     if (s->iformat)
2642.         if (s->iformat->read_close)
                  ^
2643.             s->iformat->read_close(s);
2644. 

libavformat/utils.c:2643:13: Skipping __function_pointer__(): unresolved function pointer
2641.     if (s->iformat)
2642.         if (s->iformat->read_close)
2643.             s->iformat->read_close(s);
                  ^
2644. 
2645.     avformat_free_context(s);

libavformat/utils.c:2645:5: Skipping avformat_free_context(): empty list of specs
2643.             s->iformat->read_close(s);
2644. 
2645.     avformat_free_context(s);
          ^
2646. 
2647.     *ps = NULL;

libavformat/utils.c:2647:5: 
2645.     avformat_free_context(s);
2646. 
2647.     *ps = NULL;
          ^
2648. 
2649.     avio_close(pb);

libavformat/utils.c:2649:5: 
2647.     *ps = NULL;
2648. 
2649.     avio_close(pb);
          ^
2650. }
2651. 

libavformat/aviobuf.c:935:1: start of procedure avio_close()
  933. }
  934. 
  935. int avio_close(AVIOContext *s)
       ^
  936. {
  937.     AVIOInternal *internal;

libavformat/aviobuf.c:940:10: Taking false branch
  938.     URLContext *h;
  939. 
  940.     if (!s)
                ^
  941.         return 0;
  942. 

libavformat/aviobuf.c:943:5: 
  941.         return 0;
  942. 
  943.     avio_flush(s);
           ^
  944.     internal = s->opaque;
  945.     h        = internal->h;

libavformat/aviobuf.c:219:1: start of procedure avio_flush()
    217. }
    218. 
    219. void avio_flush(AVIOContext *s)
         ^
    220. {
    221.     flush_buffer(s);

libavformat/aviobuf.c:221:5: 
    219. void avio_flush(AVIOContext *s)
    220. {
    221.     flush_buffer(s);
             ^
    222.     s->must_flush = 0;
    223. }

libavformat/aviobuf.c:163:1: start of procedure flush_buffer()
      161. }
      162. 
      163. static void flush_buffer(AVIOContext *s)
           ^
      164. {
      165.     if (s->buf_ptr > s->buffer) {

libavformat/aviobuf.c:165:9: 
      163. static void flush_buffer(AVIOContext *s)
      164. {
      165.     if (s->buf_ptr > s->buffer) {
                   ^
      166.         if (s->write_packet && !s->error) {
      167.             int ret = s->write_packet(s->opaque, s->buffer,

void avformat_close_input(AVFormatContext **ps)
{
    AVFormatContext *s = *ps;
    AVIOContext *pb    = s->pb;
    if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
        (s->flags & AVFMT_FLAG_CUSTOM_IO))
        pb = NULL;
    flush_packet_queue(s);
    if (s->iformat)
        if (s->iformat->read_close)
            s->iformat->read_close(s);
    avformat_free_context(s);
    *ps = NULL;
    avio_close(pb);
}
['void avformat_close_input(AVFormatContext **ps)\n{\n    AVFormatContext *s = *ps;\n    AVIOContext *pb    = s->pb;\n    if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||\n        (s->flags & AVFMT_FLAG_CUSTOM_IO))\n        pb = NULL;\n    flush_packet_queue(s);\n    if (s->iformat)\n        if (s->iformat->read_close)\n            s->iformat->read_close(s);\n    avformat_free_context(s);\n    *ps = NULL;\n    avio_close(pb);\n}', 'static void flush_packet_queue(AVFormatContext *s)\n{\n    free_packet_buffer(&s->internal->parse_queue,       &s->internal->parse_queue_end);\n    free_packet_buffer(&s->internal->packet_buffer,     &s->internal->packet_buffer_end);\n    free_packet_buffer(&s->internal->raw_packet_buffer, &s->internal->raw_packet_buffer_end);\n    s->internal->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE;\n}', 'int avio_close(AVIOContext *s)\n{\n    AVIOInternal *internal;\n    URLContext *h;\n    if (!s)\n        return 0;\n    avio_flush(s);\n    internal = s->opaque;\n    h        = internal->h;\n    av_opt_free(internal);\n    av_freep(&internal->protocols);\n    av_freep(&s->opaque);\n    av_freep(&s->buffer);\n    av_free(s);\n    return ffurl_close(h);\n}', 'void avio_flush(AVIOContext *s)\n{\n    flush_buffer(s);\n    s->must_flush = 0;\n}', 'static void flush_buffer(AVIOContext *s)\n{\n    if (s->buf_ptr > s->buffer) {\n        if (s->write_packet && !s->error) {\n            int ret = s->write_packet(s->opaque, s->buffer,\n                                      s->buf_ptr - s->buffer);\n            if (ret < 0) {\n                s->error = ret;\n            }\n        }\n        if (s->update_checksum) {\n            s->checksum     = s->update_checksum(s->checksum, s->checksum_ptr,\n                                                 s->buf_ptr - s->checksum_ptr);\n            s->checksum_ptr = s->buffer;\n        }\n        s->pos += s->buf_ptr - s->buffer;\n    }\n    s->buf_ptr = s->buffer;\n}']