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

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

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

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

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

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

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

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

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

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

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

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

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

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

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