libavfilter/avfilter.c:434: error: Integer Overflow L2
  ([0, +oo] - 1):unsigned32 by call to `avfilter_formats_unref`.

libavfilter/avfilter.c:428:9: Unknown value from: non-const function
426. 
427.     if(filter->filter->uninit)
428.         filter->filter->uninit(filter);
             ^
429. 
430.     for(i = 0; i < filter->input_count; i ++) {

libavfilter/avfilter.c:434:13: Call
432.             if (filter->inputs[i]->src)
433.                 filter->inputs[i]->src->outputs[filter->inputs[i]->srcpad] = NULL;
434.             avfilter_formats_unref(&filter->inputs[i]->in_formats);
                 ^
435.             avfilter_formats_unref(&filter->inputs[i]->out_formats);
436.         }

libavfilter/formats.c:136:1: <LHS trace>
134. }
135. 
136. void avfilter_formats_unref(AVFilterFormats **ref)
     ^
137. {
138.     int idx;

libavfilter/formats.c:136:1: Parameter `(*ref)->refcount`
  134. }
  135. 
  136. void avfilter_formats_unref(AVFilterFormats **ref)
       ^
  137. {
  138.     int idx;

libavfilter/formats.c:143:11: Call
  141.         return;
  142. 
  143.     idx = find_ref_index(ref);
                 ^
  144. 
  145.     if(idx >= 0)

libavfilter/formats.c:127:1: Parameter `(*ref)->refcount`
    125. }
    126. 
    127. static int find_ref_index(AVFilterFormats **ref)
         ^
    128. {
    129.     int i;

libavfilter/formats.c:149:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `avfilter_formats_unref` 
  147.             sizeof(AVFilterFormats**) * ((*ref)->refcount-idx-1));
  148. 
  149.     if(!--(*ref)->refcount) {
               ^
  150.         av_free((*ref)->formats);
  151.         av_free((*ref)->refs);

void avfilter_formats_unref(AVFilterFormats **ref)
{
    int idx;
    if (!*ref)
        return;
    idx = find_ref_index(ref);
    if(idx >= 0)
        memmove((*ref)->refs + idx, (*ref)->refs + idx+1,
            sizeof(AVFilterFormats**) * ((*ref)->refcount-idx-1));
    if(!--(*ref)->refcount) {
        av_free((*ref)->formats);
        av_free((*ref)->refs);
        av_free(*ref);
    }
    *ref = NULL;
}
['void avfilter_destroy(AVFilterContext *filter)\n{\n    int i;\n    if(filter->filter->uninit)\n        filter->filter->uninit(filter);\n    for(i = 0; i < filter->input_count; i ++) {\n        if(filter->inputs[i]) {\n            if (filter->inputs[i]->src)\n                filter->inputs[i]->src->outputs[filter->inputs[i]->srcpad] = NULL;\n            avfilter_formats_unref(&filter->inputs[i]->in_formats);\n            avfilter_formats_unref(&filter->inputs[i]->out_formats);\n        }\n        av_freep(&filter->inputs[i]);\n    }\n    for(i = 0; i < filter->output_count; i ++) {\n        if(filter->outputs[i]) {\n            if (filter->outputs[i]->dst)\n                filter->outputs[i]->dst->inputs[filter->outputs[i]->dstpad] = NULL;\n            avfilter_formats_unref(&filter->outputs[i]->in_formats);\n            avfilter_formats_unref(&filter->outputs[i]->out_formats);\n        }\n        av_freep(&filter->outputs[i]);\n    }\n    av_freep(&filter->name);\n    av_freep(&filter->input_pads);\n    av_freep(&filter->output_pads);\n    av_freep(&filter->inputs);\n    av_freep(&filter->outputs);\n    av_freep(&filter->priv);\n    av_free(filter);\n}', 'void avfilter_formats_unref(AVFilterFormats **ref)\n{\n    int idx;\n    if (!*ref)\n        return;\n    idx = find_ref_index(ref);\n    if(idx >= 0)\n        memmove((*ref)->refs + idx, (*ref)->refs + idx+1,\n            sizeof(AVFilterFormats**) * ((*ref)->refcount-idx-1));\n    if(!--(*ref)->refcount) {\n        av_free((*ref)->formats);\n        av_free((*ref)->refs);\n        av_free(*ref);\n    }\n    *ref = NULL;\n}', 'static int find_ref_index(AVFilterFormats **ref)\n{\n    int i;\n    for(i = 0; i < (*ref)->refcount; i ++)\n        if((*ref)->refs[i] == ref)\n            return i;\n    return -1;\n}']