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

Function buffer_replace

libavutil/buffer.c:117–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117static void buffer_replace(AVBufferRef **dst, AVBufferRef **src)
118{
119 AVBuffer *b;
120
121 b = (*dst)->buffer;
122
123 if (src) {
124 **dst = **src;
125 av_freep(src);
126 } else
127 av_freep(dst);
128
129 if (atomic_fetch_sub_explicit(&b->refcount, 1, memory_order_acq_rel) == 1) {
130 /* b->free below might already free the structure containing *b,
131 * so we have to read the flag now to avoid use-after-free. */
132 int free_avbuffer = !(b->flags_internal & BUFFER_FLAG_NO_FREE);
133 b->free(b->opaque, b->data);
134 if (free_avbuffer)
135 av_free(b);
136 }
137}
138
139void av_buffer_unref(AVBufferRef **buf)
140{

Callers 3

av_buffer_unrefFunction · 0.85
av_buffer_make_writableFunction · 0.85
av_buffer_reallocFunction · 0.85

Calls 2

av_freepFunction · 0.85
av_freeFunction · 0.70

Tested by

no test coverage detected