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

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

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

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

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

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

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

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

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

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

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

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

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

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

libavcodec/utils.c:531:13: 
529. 
530.         if (buf != last)
531.             FFSWAP(InternalBuffer, *buf, *last);
                 ^
532.     }
533. 
