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

libavcodec/utils.c:506:1: start of procedure avcodec_default_release_buffer()
504. }
505. 
506. void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){
     ^
507.     int i;
508.     InternalBuffer *buf, *last;

libavcodec/utils.c:509:5: 
507.     int i;
508.     InternalBuffer *buf, *last;
509.     AVCodecInternal *avci = s->internal;
         ^
510. 
511.     assert(s->codec_type == AVMEDIA_TYPE_VIDEO);

libavcodec/utils.c:511:5: 
509.     AVCodecInternal *avci = s->internal;
510. 
511.     assert(s->codec_type == AVMEDIA_TYPE_VIDEO);
         ^
512. 
513.     assert(pic->type==FF_BUFFER_TYPE_INTERNAL);

libavcodec/utils.c:513:5: 
511.     assert(s->codec_type == AVMEDIA_TYPE_VIDEO);
512. 
513.     assert(pic->type==FF_BUFFER_TYPE_INTERNAL);
         ^
514.     assert(avci->buffer_count);
515. 

libavcodec/utils.c:514:5: 
512. 
513.     assert(pic->type==FF_BUFFER_TYPE_INTERNAL);
514.     assert(avci->buffer_count);
         ^
515. 
516.     if (avci->buffer) {

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

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

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

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

libavcodec/utils.c:523:9: 
521.                 break;
522.         }
523.         assert(i < avci->buffer_count);
             ^
524.         avci->buffer_count--;
525.         last = &avci->buffer[avci->buffer_count];

libavcodec/utils.c:524:9: 
522.         }
523.         assert(i < avci->buffer_count);
524.         avci->buffer_count--;
             ^
525.         last = &avci->buffer[avci->buffer_count];
526. 

libavcodec/utils.c:525:9: 
523.         assert(i < avci->buffer_count);
524.         avci->buffer_count--;
525.         last = &avci->buffer[avci->buffer_count];
             ^
526. 
527.         if (buf != last)

libavcodec/utils.c:527:13: Taking true branch
525.         last = &avci->buffer[avci->buffer_count];
526. 
527.         if (buf != last)
                 ^
528.             FFSWAP(InternalBuffer, *buf, *last);
529.     }

libavcodec/utils.c:528:13: 
526. 
527.         if (buf != last)
528.             FFSWAP(InternalBuffer, *buf, *last);
                 ^
529.     }
530. 
