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

libavcodec/utils.c:487:1: start of procedure avcodec_default_release_buffer()
485. }
486. 
487. void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic)
     ^
488. {
489.     int i;

libavcodec/utils.c:491:5: 
489.     int i;
490.     InternalBuffer *buf, *last;
491.     AVCodecInternal *avci = s->internal;
         ^
492. 
493.     assert(s->codec_type == AVMEDIA_TYPE_VIDEO);

libavcodec/utils.c:493:5: 
491.     AVCodecInternal *avci = s->internal;
492. 
493.     assert(s->codec_type == AVMEDIA_TYPE_VIDEO);
         ^
494. 
495.     assert(pic->type == FF_BUFFER_TYPE_INTERNAL);

libavcodec/utils.c:495:5: 
493.     assert(s->codec_type == AVMEDIA_TYPE_VIDEO);
494. 
495.     assert(pic->type == FF_BUFFER_TYPE_INTERNAL);
         ^
496.     assert(avci->buffer_count);
497. 

libavcodec/utils.c:496:5: 
494. 
495.     assert(pic->type == FF_BUFFER_TYPE_INTERNAL);
496.     assert(avci->buffer_count);
         ^
497. 
498.     if (avci->buffer) {

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

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

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

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

libavcodec/utils.c:505:9: 
503.                 break;
504.         }
505.         assert(i < avci->buffer_count);
             ^
506.         avci->buffer_count--;
507.         last = &avci->buffer[avci->buffer_count];

libavcodec/utils.c:506:9: 
504.         }
505.         assert(i < avci->buffer_count);
506.         avci->buffer_count--;
             ^
507.         last = &avci->buffer[avci->buffer_count];
508. 

libavcodec/utils.c:507:9: 
505.         assert(i < avci->buffer_count);
506.         avci->buffer_count--;
507.         last = &avci->buffer[avci->buffer_count];
             ^
508. 
509.         if (buf != last)

libavcodec/utils.c:509:13: Taking true branch
507.         last = &avci->buffer[avci->buffer_count];
508. 
509.         if (buf != last)
                 ^
510.             FFSWAP(InternalBuffer, *buf, *last);
511.     }

libavcodec/utils.c:510:13: 
508. 
509.         if (buf != last)
510.             FFSWAP(InternalBuffer, *buf, *last);
                 ^
511.     }
512. 
