AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask)
{
    AVFilterBufferRef *ret = av_malloc(sizeof(AVFilterBufferRef));
    *ret = *ref;
    if (ref->type == AVMEDIA_TYPE_VIDEO) {
        ret->video = av_malloc(sizeof(AVFilterBufferRefVideoProps));
        *ret->video = *ref->video;
    }
    ret->perms &= pmask;
    ret->buf->refcount ++;
    return ret;
}
['AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask)\n{\n    AVFilterBufferRef *ret = av_malloc(sizeof(AVFilterBufferRef));\n    *ret = *ref;\n    if (ref->type == AVMEDIA_TYPE_VIDEO) {\n        ret->video = av_malloc(sizeof(AVFilterBufferRefVideoProps));\n        *ret->video = *ref->video;\n    }\n    ret->perms &= pmask;\n    ret->buf->refcount ++;\n    return ret;\n}', 'void *av_malloc(unsigned int size)\n{\n    void *ptr = NULL;\n#if CONFIG_MEMALIGN_HACK\n    long diff;\n#endif\n    if(size > (INT_MAX-16) )\n        return NULL;\n#if CONFIG_MEMALIGN_HACK\n    ptr = malloc(size+16);\n    if(!ptr)\n        return ptr;\n    diff= ((-(long)ptr - 1)&15) + 1;\n    ptr = (char*)ptr + diff;\n    ((char*)ptr)[-1]= diff;\n#elif HAVE_POSIX_MEMALIGN\n    if (posix_memalign(&ptr,16,size))\n        ptr = NULL;\n#elif HAVE_MEMALIGN\n    ptr = memalign(16,size);\n#else\n    ptr = malloc(size);\n#endif\n    return ptr;\n}']