libavcodec/utils.c:503: error: Null Dereference
  pointer `buf` last assigned on line 492 could be null and is dereferenced at line 503, column 13.

libavcodec/utils.c:481:1: start of procedure avcodec_default_release_buffer()
479. }
480. 
481. void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){
     ^
482.     int i;
483.     InternalBuffer *buf, *last;

libavcodec/utils.c:484:5: 
482.     int i;
483.     InternalBuffer *buf, *last;
484.     AVCodecInternal *avci = s->internal;
         ^
485. 
486.     assert(s->codec_type == AVMEDIA_TYPE_VIDEO);

libavcodec/utils.c:486:5: 
484.     AVCodecInternal *avci = s->internal;
485. 
486.     assert(s->codec_type == AVMEDIA_TYPE_VIDEO);
         ^
487. 
488.     assert(pic->type==FF_BUFFER_TYPE_INTERNAL);

libavcodec/utils.c:488:5: 
486.     assert(s->codec_type == AVMEDIA_TYPE_VIDEO);
487. 
488.     assert(pic->type==FF_BUFFER_TYPE_INTERNAL);
         ^
489.     assert(avci->buffer_count);
490. 

libavcodec/utils.c:489:5: 
487. 
488.     assert(pic->type==FF_BUFFER_TYPE_INTERNAL);
489.     assert(avci->buffer_count);
         ^
490. 
491.     if (avci->buffer) {

libavcodec/utils.c:491:9: Taking true branch
489.     assert(avci->buffer_count);
490. 
491.     if (avci->buffer) {
             ^
492.         buf = NULL; /* avoids warning */
493.         for (i = 0; i < avci->buffer_count; i++) { //just 3-5 checks so is not worth to optimize

libavcodec/utils.c:492:9: 
490. 
491.     if (avci->buffer) {
492.         buf = NULL; /* avoids warning */
             ^
493.         for (i = 0; i < avci->buffer_count; i++) { //just 3-5 checks so is not worth to optimize
494.             buf = &avci->buffer[i];

libavcodec/utils.c:493:14: 
491.     if (avci->buffer) {
492.         buf = NULL; /* avoids warning */
493.         for (i = 0; i < avci->buffer_count; i++) { //just 3-5 checks so is not worth to optimize
                  ^
494.             buf = &avci->buffer[i];
495.             if (buf->data[0] == pic->data[0])

libavcodec/utils.c:493:21: Loop condition is false. Leaving loop
491.     if (avci->buffer) {
492.         buf = NULL; /* avoids warning */
493.         for (i = 0; i < avci->buffer_count; i++) { //just 3-5 checks so is not worth to optimize
                         ^
494.             buf = &avci->buffer[i];
495.             if (buf->data[0] == pic->data[0])

libavcodec/utils.c:498:9: 
496.                 break;
497.         }
498.         assert(i < avci->buffer_count);
             ^
499.         avci->buffer_count--;
500.         last = &avci->buffer[avci->buffer_count];

libavcodec/utils.c:499:9: 
497.         }
498.         assert(i < avci->buffer_count);
499.         avci->buffer_count--;
             ^
500.         last = &avci->buffer[avci->buffer_count];
501. 

libavcodec/utils.c:500:9: 
498.         assert(i < avci->buffer_count);
499.         avci->buffer_count--;
500.         last = &avci->buffer[avci->buffer_count];
             ^
501. 
502.         if (buf != last)

libavcodec/utils.c:502:13: Taking true branch
500.         last = &avci->buffer[avci->buffer_count];
501. 
502.         if (buf != last)
                 ^
503.             FFSWAP(InternalBuffer, *buf, *last);
504.     }

libavcodec/utils.c:503:13: 
501. 
502.         if (buf != last)
503.             FFSWAP(InternalBuffer, *buf, *last);
                 ^
504.     }
505. 
