MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / av_refstruct_alloc_ext_c

Function av_refstruct_alloc_ext_c

libavutil/refstruct.c:102–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102void *av_refstruct_alloc_ext_c(size_t size, unsigned flags, AVRefStructOpaque opaque,
103 void (*free_cb)(AVRefStructOpaque opaque, void *obj))
104{
105 void *buf, *obj;
106
107 if (size > SIZE_MAX - REFCOUNT_OFFSET)
108 return NULL;
109 buf = av_malloc(size + REFCOUNT_OFFSET);
110 if (!buf)
111 return NULL;
112 refcount_init(buf, opaque, free_cb);
113 obj = get_userdata(buf);
114 if (!(flags & AV_REFSTRUCT_FLAG_NO_ZEROING))
115 memset(obj, 0, size);
116
117 return obj;
118}
119
120void av_refstruct_unref(void *objp)
121{

Callers 2

av_refstruct_alloc_extFunction · 0.85
cbs_alloc_contentFunction · 0.85

Calls 3

refcount_initFunction · 0.85
get_userdataFunction · 0.85
av_mallocFunction · 0.70

Tested by

no test coverage detected