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

libavformat/utils.c:2702:1: start of procedure avformat_close_input()
2700. #endif
2701. 
2702. void avformat_close_input(AVFormatContext **ps)
      ^
2703. {
2704.     AVFormatContext *s = *ps;

libavformat/utils.c:2704:5: 
2702. void avformat_close_input(AVFormatContext **ps)
2703. {
2704.     AVFormatContext *s = *ps;
          ^
2705.     AVIOContext *pb = s->pb;
2706. 

libavformat/utils.c:2705:5: 
2703. {
2704.     AVFormatContext *s = *ps;
2705.     AVIOContext *pb = s->pb;
          ^
2706. 
2707.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) &&

libavformat/utils.c:2707:10: Taking true branch
2705.     AVIOContext *pb = s->pb;
2706. 
2707.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) &&
               ^
2708.         (s->flags & AVFMT_FLAG_CUSTOM_IO))
2709.         pb = NULL;

libavformat/utils.c:2707:24: Taking true branch
2705.     AVIOContext *pb = s->pb;
2706. 
2707.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) &&
                             ^
2708.         (s->flags & AVFMT_FLAG_CUSTOM_IO))
2709.         pb = NULL;

libavformat/utils.c:2708:10: Taking true branch
2706. 
2707.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) &&
2708.         (s->flags & AVFMT_FLAG_CUSTOM_IO))
               ^
2709.         pb = NULL;
2710. 

libavformat/utils.c:2709:9: 
2707.     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) &&
2708.         (s->flags & AVFMT_FLAG_CUSTOM_IO))
2709.         pb = NULL;
              ^
2710. 
2711.     flush_packet_queue(s);

libavformat/utils.c:2711:5: Skipping flush_packet_queue(): empty list of specs
2709.         pb = NULL;
2710. 
2711.     flush_packet_queue(s);
          ^
2712. 
2713.     if (s->iformat) {

libavformat/utils.c:2713:9: Taking true branch
2711.     flush_packet_queue(s);
2712. 
2713.     if (s->iformat) {
              ^
2714.         if (s->iformat->read_close)
2715.             s->iformat->read_close(s);

libavformat/utils.c:2714:13: Taking true branch
2712. 
2713.     if (s->iformat) {
2714.         if (s->iformat->read_close)
                  ^
2715.             s->iformat->read_close(s);
2716.     }

libavformat/utils.c:2715:13: Skipping __function_pointer__(): unresolved function pointer
2713.     if (s->iformat) {
2714.         if (s->iformat->read_close)
2715.             s->iformat->read_close(s);
                  ^
2716.     }
2717. 

libavformat/utils.c:2718:5: Skipping avformat_free_context(): empty list of specs
2716.     }
2717. 
2718.     avformat_free_context(s);
          ^
2719. 
2720.     *ps = NULL;

libavformat/utils.c:2720:5: 
2718.     avformat_free_context(s);
2719. 
2720.     *ps = NULL;
          ^
2721. 
2722.     avio_close(pb);

libavformat/utils.c:2722:5: 
2720.     *ps = NULL;
2721. 
2722.     avio_close(pb);
          ^
2723. }
2724. 

libavformat/aviobuf.c:757:1: start of procedure avio_close()
  755. }
  756. 
  757. int avio_close(AVIOContext *s)
       ^
  758. {
  759.     URLContext *h;

libavformat/aviobuf.c:761:10: Taking false branch
  759.     URLContext *h;
  760. 
  761.     if (!s)
                ^
  762.         return 0;
  763. 

libavformat/aviobuf.c:764:5: 
  762.         return 0;
  763. 
  764.     avio_flush(s);
           ^
  765.     h = s->opaque;
  766.     av_freep(&s->buffer);

libavformat/aviobuf.c:174:1: start of procedure avio_flush()
    172. }
    173. 
    174. void avio_flush(AVIOContext *s)
         ^
    175. {
    176.     flush_buffer(s);

libavformat/aviobuf.c:176:5: 
    174. void avio_flush(AVIOContext *s)
    175. {
    176.     flush_buffer(s);
             ^
    177.     s->must_flush = 0;
    178. }

libavformat/aviobuf.c:120:1: start of procedure flush_buffer()
      118. }
      119. 
      120. static void flush_buffer(AVIOContext *s)
           ^
      121. {
      122.     if (s->buf_ptr > s->buffer) {

libavformat/aviobuf.c:122:9: 
      120. static void flush_buffer(AVIOContext *s)
      121. {
      122.     if (s->buf_ptr > s->buffer) {
                   ^
      123.         if (s->write_packet && !s->error){
      124.             int ret= s->write_packet(s->opaque, s->buffer, s->buf_ptr - 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    }\n    avformat_free_context(s);\n    *ps = NULL;\n    avio_close(pb);\n}', 'int avio_close(AVIOContext *s)\n{\n    URLContext *h;\n    if (!s)\n        return 0;\n    avio_flush(s);\n    h = 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, 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, 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}']