ffmpeg/libavutil
wm4 fbd6c97f9c lavu: fix memory leaks by using a mutex instead of atomics
The buffer pool has to atomically add and remove entries from the linked
list of available buffers. This was done by removing the entire list
with a CAS operation, working on it, and then setting it back again
(using a retry-loop in case another thread was doing the same thing).

This could effectively cause memory leaks: while a thread was working on
the buffer list, other threads would allocate new buffers, increasing
the pool's total size. There was no real leak, but since these extra
buffers were not needed, but not free'd either (except when the buffer
pool was destroyed), this had the same effects as a real leak. For some
reason, growth was exponential, and could easily kill the process due
to OOM in real-world uses.

Fix this by using a mutex to protect the list operations. The fancy
way atomics remove the whole list to work on it is not needed anymore,
which also avoids the situation which was causing the leak.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-11-27 13:36:00 +01:00
..
aarch64 aarch64: use MACH-O const data asm directive in const macro 2014-08-04 00:17:21 +02:00
arm arm: Macroize the test for 'setend' CPU instruction support 2014-07-21 15:08:01 -07:00
avr32 Replace FFmpeg with Libav in licence headers 2011-03-19 13:33:20 +00:00
bfin Remove all Blackfin architecture optimizations 2014-06-02 08:41:47 -07:00
mips mips: intreadwrite: fix inline asm for gcc 4.8 2012-05-09 13:45:22 +01:00
ppc ppc: Support little endian intreadwrite 2014-09-03 02:38:03 +02:00
sh4 Replace FFmpeg with Libav in licence headers 2011-03-19 13:33:20 +00:00
tomi intreadwrite: tomi: Add missing attributes.h #include for av_always_inline 2013-02-20 00:45:30 +01:00
x86 x86inc: Make INIT_CPUFLAGS support an arbitrary number of cpuflags 2014-09-09 02:00:25 -07:00
adler32.c adler32: Fix doxy group definition 2014-04-07 01:31:02 +02:00
adler32.h adler32: Fix doxy group definition 2014-04-07 01:31:02 +02:00
aes.c avutil: remove timer.h include from internal.h 2014-01-25 21:50:20 +01:00
aes.h avutil: Add functions for allocating opaque contexts for algorithms 2012-10-11 23:35:27 +03:00
atomic_gcc.h atomic: fix CAS with armcc. 2013-03-09 08:36:40 +01:00
atomic_suncc.h atomic: Add include guards to the implementation headers 2013-03-08 12:00:06 +02:00
atomic_win32.h atomic_win32: Drop unnecessary atomic.h #include 2014-08-15 09:52:57 +02:00
atomic.c threads: Check w32threads dependencies at the configure stage 2014-02-19 15:12:37 +01:00
atomic.h atomics: cosmetics: Restructure ifdefs for greater clarity 2013-12-20 11:23:13 +01:00
attributes.h attributes: disable flatten on llvm/clang 2013-11-03 11:51:40 +01:00
audio_fifo.c Don't include common.h from avutil.h 2012-08-15 22:32:06 +03:00
audio_fifo.h audio_fifo: Split into a separate doxygen module 2014-07-06 11:44:10 -07:00
audioconvert.h lavu: rename audioconvert.* to channel_layout.* and deprecate audioconvert.h 2012-11-11 13:35:12 -05:00
avassert.h multiple inclusion guard cleanup 2011-05-21 13:48:10 +02:00
avstring.c avstring: Expose the simple name match function 2014-07-29 17:46:29 +02:00
avstring.h avstring: Mark some character handling functions av_const 2014-11-07 11:57:16 +02:00
avutil.h avutil: move av_get_time_base_q() after include rational.h 2014-04-22 17:35:51 -04:00
base64.c base64-test: Remove posibility of returning restricted exit codes 2013-10-25 11:06:32 +01:00
base64.h doxy: provide a start page and document libavutil 2011-11-22 17:16:02 +01:00
blowfish.c Drop pointless directory name prefixes from #includes in the current dir 2013-09-10 12:38:41 +02:00
blowfish.h Add Blowfish encryption support in libavutil 2012-07-04 15:10:57 +03:00
bswap.h aarch64: bswap inline assembly 2014-01-14 22:19:38 +01:00
buffer_internal.h lavu: fix memory leaks by using a mutex instead of atomics 2014-11-27 13:36:00 +01:00
buffer.c lavu: fix memory leaks by using a mutex instead of atomics 2014-11-27 13:36:00 +01:00
buffer.h avutil: doxy: Small clarification for av_buffer_create() 2013-04-30 13:33:43 -04:00
channel_layout.c Add missing #includes for *INT64_MAX and *INT64_C 2013-11-23 21:55:52 +01:00
channel_layout.h lavu: Add values for various Dolby flags to the AVMatrixEncoding enum. 2014-01-05 16:41:56 +01:00
colorspace.h Replace FFmpeg with Libav in licence headers 2011-03-19 13:33:20 +00:00
common.h Add missing #includes for *INT64_MAX and *INT64_C 2013-11-23 21:55:52 +01:00
cpu_internal.h aarch64: add cpuflags support for NEON and VFP 2014-01-15 12:05:09 +01:00
cpu.c cpu-test: Add unistd.h #include for getopt() 2014-08-13 12:37:25 -07:00
cpu.h aarch64: add armv8 CPU flag 2014-04-06 21:18:49 +02:00
crc.c crc: add ANSI CRC16 LE 2014-04-17 20:08:19 +02:00
crc.h crc: add ANSI CRC16 LE 2014-04-17 20:08:19 +02:00
des.c Drop pointless directory name prefixes from #includes in the current dir 2013-09-10 12:38:41 +02:00
des.h des: add possibility to calculate DES-CBC-MAC with small buffer 2011-09-21 08:28:20 +02:00
dict.c av_dict_set: fix potential memory leak with AV_DICT_DONT_OVERWRITE 2014-06-09 12:33:19 +02:00
dict.h dict: const correctness for av_dict_get() and av_dict_copy() 2014-06-05 09:16:15 -07:00
display.c display: add matrix flip api 2014-07-09 10:14:12 -04:00
display.h display: add matrix flip api 2014-07-09 10:14:12 -04:00
downmix_info.c lavu: add AV_FRAME_DATA_DOWNMIX_INFO side data type. 2014-02-15 22:24:53 +01:00
downmix_info.h lavu: add AV_FRAME_DATA_DOWNMIX_INFO side data type. 2014-02-15 22:24:53 +01:00
error.c avutil: Add AVERROR_EXPERIMENTAL 2012-10-21 22:38:21 +02:00
error.h avresample: Introduce AVFrame-based API 2014-08-10 14:26:37 +02:00
eval.c cosmetics: Write NULL pointer equality checks more compactly 2014-08-15 03:18:18 -07:00
eval.h Fix a bunch of common typos. 2011-12-11 00:32:25 +01:00
fifo.c fifo: K&R formatting cosmetics 2013-07-06 14:28:06 +02:00
fifo.h lavu: remove disabled FF_API_AV_FIFO_PEEK cruft 2012-10-23 07:33:05 +02:00
file_open.c Share the utf8 to wchar conversion routine between lavf and lavu 2014-11-27 09:29:17 +02:00
file.c libavutil: Move avpriv_open to a new file, file_open.c 2013-08-10 00:53:33 +03:00
file.h Don't include common.h from avutil.h 2012-08-15 22:32:06 +03:00
float_dsp.c float_dsp: Replace arch optimization ifdefs by if cascade 2014-03-22 14:11:22 +01:00
float_dsp.h aarch64: float_dsp NEON assembler 2014-03-18 22:56:07 +01:00
frame.c frame: Remove some FF_API_AVFRAME_COLORSPACE leftovers 2014-08-14 00:44:47 -07:00
frame.h Remove obsolete FF_API_AVFRAME_COLORSPACE cruft. 2014-08-09 16:59:13 +00:00
hmac.c avutil: Add av_cold attributes to init functions missing them 2013-05-04 22:48:05 +02:00
hmac.h lavu: Add an API for calculating HMAC (RFC 2104) 2013-01-15 11:54:19 +02:00
imgutils.c Add av_image_check_sar() and use it to validate SAR 2014-06-20 10:39:33 -04:00
imgutils.h imgutils: Do not declare avpriv_set_systematic_pal2 in the public header 2014-08-04 02:52:33 -07:00
internal.h lavu: move internal define to the only places where it is used 2014-11-24 01:30:14 +00:00
intfloat.h intfloat: Don't use designated initializers in the public headers 2012-07-02 14:05:40 +03:00
intmath.c lavu: add av_ctz() for trailing zero bit count 2012-11-05 15:32:29 -05:00
intmath.h lavu: add av_ctz() for trailing zero bit count 2012-11-05 15:32:29 -05:00
intreadwrite.h intreadwrite: Add AV_COPYxxU macros for copying to/from unaligned addresses 2012-10-23 16:54:08 +02:00
lfg.c avformat: Remove non-compiling and/or silly commented-out printf/av_log statements 2012-10-01 10:24:28 +02:00
lfg.h Give all anonymously typedeffed structs in headers a name 2012-10-06 09:27:11 +02:00
libavutil.v Revert "avutil: make some tables visible again" 2012-10-23 07:33:05 +02:00
libm.h libm: add fallbacks for various single-precision functions 2012-10-23 12:00:21 +01:00
lls.c x86: lpc: simd av_update_lls 2013-06-29 13:23:57 +02:00
lls.h x86: lpc: simd av_update_lls 2013-06-29 13:23:57 +02:00
log2_tab.c avutil: Duplicate ff_log2_tab instead of sharing it across libs 2012-10-12 20:39:17 +02:00
log.c log: Unbreak no-tty support on 256color terminals 2014-09-26 20:56:16 +02:00
log.h log: Document AV_LOG_C usage 2014-04-03 18:43:24 +02:00
lzo.c lzo: Handle integer overflow 2014-06-23 10:20:57 +02:00
lzo.h avutil: Move memcpy_backptr() to mem.c 2012-10-25 11:36:57 +02:00
macros.h lavu: Move preprocessor macros in a separate file 2013-12-29 22:52:04 +01:00
Makefile Add transformation matrix API. 2014-05-19 13:13:10 +02:00
mathematics.c mathematics: K&R formatting cosmetics 2014-05-03 18:31:18 +02:00
mathematics.h mathematics: Don't use division by zero in NAN/INFINITY macros 2012-07-01 19:06:13 +03:00
md5.c Remove pointless #undefs of previously forbidden functions. 2012-12-04 21:40:22 +01:00
md5.h avutil: Add functions for allocating opaque contexts for algorithms 2012-10-11 23:35:27 +03:00
mem.c mem: add av_strndup() for duplicating substrings 2014-08-13 17:24:18 +00:00
mem.h mem: add av_strndup() for duplicating substrings 2014-08-13 17:24:18 +00:00
old_pix_fmts.h Deprecate obsolete XvMC hardware decoding support 2013-11-13 21:07:45 +01:00
opt.c cosmetics: Write NULL pointer inequality checks more compactly 2014-08-15 05:34:13 -07:00
opt.h opt: Fix the documentation mentioning av_set_string3 2014-11-11 11:49:55 +01:00
parseutils.c Use gmtime_r instead of gmtime and localtime_r instead of localtime 2014-10-26 00:14:54 +03:00
parseutils.h doxygen: misc consistency, spelling and wording fixes 2011-12-12 23:06:23 +01:00
pixdesc.c pixdesc: return color properties names 2014-10-08 18:17:49 +01:00
pixdesc.h pixdesc: return color properties names 2014-10-08 18:17:49 +01:00
pixfmt.h pixfmt: mark further reserved values 2014-10-08 18:17:49 +01:00
random_seed.c random_seed: Rewrite the generic clock() based seed code 2014-01-06 18:53:58 +02:00
random_seed.h doxy: provide a start page and document libavutil 2011-11-22 17:16:02 +01:00
rational.c Remove commented-out #includes 2013-05-15 23:01:21 +02:00
rational.h rational: add av_inv_q() returning the inverse of an AVRational 2012-08-05 17:46:41 +01:00
rc4.c Replace FFmpeg with Libav in licence headers 2011-03-19 13:33:20 +00:00
rc4.h doxygen: Consistently use '@' instead of '\' for Doxygen markup. 2011-06-24 00:37:49 +02:00
replaygain.h replaygain: correctly parse peak values 2014-04-04 17:40:19 +02:00
samplefmt.c samplefmt: avoid integer overflow in av_samples_get_buffer_size() 2014-02-04 12:32:47 -05:00
samplefmt.h samplefmt: Add doxygen categories 2014-07-06 11:44:01 -07:00
sha.c avutil: Add av_cold attributes to init functions missing them 2013-05-04 22:48:05 +02:00
sha.h avutil: Add functions for allocating opaque contexts for algorithms 2012-10-11 23:35:27 +03:00
stereo3d.c stereo3d: initialize AVStereo3D to zero 2014-08-13 17:24:18 +00:00
stereo3d.h stereo3d: add missing include guards 2014-06-19 17:31:49 -04:00
thread.h lavu: add wrappers for the pthreads mutex API 2014-11-27 13:36:00 +01:00
time_internal.h lavu: Provide fallbacks for gmtime_r and localtime_r 2014-10-26 00:14:54 +03:00
time.c lavu: Add av_gettime_relative 2014-10-24 09:53:41 +03:00
time.h lavu: Add av_gettime_relative 2014-10-24 09:53:41 +03:00
timer.h timer: use mach_absolute_time as high resolution clock on darwin 2014-03-09 00:45:34 +01:00
tree.c tree-test: Don't return restricted exit codes 2013-10-24 10:59:26 +01:00
tree.h tree.h: K&R formatting and typo cosmetics 2013-07-31 18:14:08 +02:00
utils.c avutil: Add av_get_time_base_q() 2014-04-22 16:32:35 -04:00
version.h lavu: Add av_gettime_relative 2014-10-24 09:53:41 +03:00
wchar_filename.h Share the utf8 to wchar conversion routine between lavf and lavu 2014-11-27 09:29:17 +02:00
xtea.c xtea: Add Doxy @file and group 2014-04-07 01:31:36 +02:00
xtea.h xtea: Add Doxy @file and group 2014-04-07 01:31:36 +02:00