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

libavcodec/utils.c:340:1: start of procedure avcodec_default_release_buffer()
338. }
339. 
340. void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){
     ^
341.     int i;
342.     InternalBuffer *buf, *last;

libavcodec/utils.c:344:5: 
342.     InternalBuffer *buf, *last;
343. 
344.     assert(pic->type==FF_BUFFER_TYPE_INTERNAL);
         ^
345.     assert(s->internal_buffer_count);
346. 

libavcodec/utils.c:345:5: 
343. 
344.     assert(pic->type==FF_BUFFER_TYPE_INTERNAL);
345.     assert(s->internal_buffer_count);
         ^
346. 
347.     buf = NULL; /* avoids warning */

libavcodec/utils.c:347:5: 
345.     assert(s->internal_buffer_count);
346. 
347.     buf = NULL; /* avoids warning */
         ^
348.     for(i=0; i<s->internal_buffer_count; i++){ //just 3-5 checks so is not worth to optimize
349.         buf= &((InternalBuffer*)s->internal_buffer)[i];

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

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

libavcodec/utils.c:353:5: 
351.             break;
352.     }
353.     assert(i < s->internal_buffer_count);
         ^
354.     s->internal_buffer_count--;
355.     last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count];

libavcodec/utils.c:354:5: 
352.     }
353.     assert(i < s->internal_buffer_count);
354.     s->internal_buffer_count--;
         ^
355.     last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count];
356. 

libavcodec/utils.c:355:5: 
353.     assert(i < s->internal_buffer_count);
354.     s->internal_buffer_count--;
355.     last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count];
         ^
356. 
357.     FFSWAP(InternalBuffer, *buf, *last);

libavcodec/utils.c:357:5: 
355.     last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count];
356. 
357.     FFSWAP(InternalBuffer, *buf, *last);
         ^
358. 
359.     for(i=0; i<4; i++){

void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){
    int i;
    InternalBuffer *buf, *last;
    assert(pic->type==FF_BUFFER_TYPE_INTERNAL);
    assert(s->internal_buffer_count);
    buf = NULL;
    for(i=0; i<s->internal_buffer_count; i++){
        buf= &((InternalBuffer*)s->internal_buffer)[i];
        if(buf->data[0] == pic->data[0])
            break;
    }
    assert(i < s->internal_buffer_count);
    s->internal_buffer_count--;
    last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count];
    FFSWAP(InternalBuffer, *buf, *last);
    for(i=0; i<4; i++){
        pic->data[i]=NULL;
    }
}
['void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){\n    int i;\n    InternalBuffer *buf, *last;\n    assert(pic->type==FF_BUFFER_TYPE_INTERNAL);\n    assert(s->internal_buffer_count);\n    buf = NULL;\n    for(i=0; i<s->internal_buffer_count; i++){\n        buf= &((InternalBuffer*)s->internal_buffer)[i];\n        if(buf->data[0] == pic->data[0])\n            break;\n    }\n    assert(i < s->internal_buffer_count);\n    s->internal_buffer_count--;\n    last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count];\n    FFSWAP(InternalBuffer, *buf, *last);\n    for(i=0; i<4; i++){\n        pic->data[i]=NULL;\n    }\n}']