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

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

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

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

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

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

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

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

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

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

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

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

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

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

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