[FFmpeg-devel] Memory leaks using x265 encoder

Nicolas George george at nsup.org
Wed Jan 2 17:05:51 EET 2019

Oliver Collyer (2019-01-02):
> diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c

Please use git format-patch to prepare your patches. Also please try to
convince your MUA to use text/plain for patches.

> +static int open_enc_count = 0;
> +static pthread_mutex_t open_enc_count_lock = PTHREAD_MUTEX_INITIALIZER;

Static variables are unacceptable. And indeed, these are wrong: you are
counting several instances, possibly of different APIs, but with a
single counter.

The way I read things, the leak you are trying to fix does not exist: it
is global state, kept until the end but not lost.


  Nicolas George

More information about the ffmpeg-devel mailing list