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

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

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

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

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

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

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

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

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

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

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

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

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

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

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