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

libavcodec/utils.c:381:1: start of procedure avcodec_default_release_buffer()
379. }
380. 
381. void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){
     ^
382.     int i;
383.     InternalBuffer *buf, *last;

libavcodec/utils.c:385:5: 
383.     InternalBuffer *buf, *last;
384. 
385.     assert(pic->type==FF_BUFFER_TYPE_INTERNAL);
         ^
386.     assert(s->internal_buffer_count);
387. 

libavcodec/utils.c:386:5: 
384. 
385.     assert(pic->type==FF_BUFFER_TYPE_INTERNAL);
386.     assert(s->internal_buffer_count);
         ^
387. 
388.     if(s->internal_buffer){

libavcodec/utils.c:388:8: Taking true branch
386.     assert(s->internal_buffer_count);
387. 
388.     if(s->internal_buffer){
            ^
389.     buf = NULL; /* avoids warning */
390.     for(i=0; i<s->internal_buffer_count; i++){ //just 3-5 checks so is not worth to optimize

libavcodec/utils.c:389:5: 
387. 
388.     if(s->internal_buffer){
389.     buf = NULL; /* avoids warning */
         ^
390.     for(i=0; i<s->internal_buffer_count; i++){ //just 3-5 checks so is not worth to optimize
391.         buf= &((InternalBuffer*)s->internal_buffer)[i];

libavcodec/utils.c:390:9: 
388.     if(s->internal_buffer){
389.     buf = NULL; /* avoids warning */
390.     for(i=0; i<s->internal_buffer_count; i++){ //just 3-5 checks so is not worth to optimize
             ^
391.         buf= &((InternalBuffer*)s->internal_buffer)[i];
392.         if(buf->data[0] == pic->data[0])

libavcodec/utils.c:390:14: Loop condition is false. Leaving loop
388.     if(s->internal_buffer){
389.     buf = NULL; /* avoids warning */
390.     for(i=0; i<s->internal_buffer_count; i++){ //just 3-5 checks so is not worth to optimize
                  ^
391.         buf= &((InternalBuffer*)s->internal_buffer)[i];
392.         if(buf->data[0] == pic->data[0])

libavcodec/utils.c:395:5: 
393.             break;
394.     }
395.     assert(i < s->internal_buffer_count);
         ^
396.     s->internal_buffer_count--;
397.     last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count];

libavcodec/utils.c:396:5: 
394.     }
395.     assert(i < s->internal_buffer_count);
396.     s->internal_buffer_count--;
         ^
397.     last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count];
398. 

libavcodec/utils.c:397:5: 
395.     assert(i < s->internal_buffer_count);
396.     s->internal_buffer_count--;
397.     last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count];
         ^
398. 
399.     FFSWAP(InternalBuffer, *buf, *last);

libavcodec/utils.c:399:5: 
397.     last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count];
398. 
399.     FFSWAP(InternalBuffer, *buf, *last);
         ^
400.     }
401. 
