[x264-devel] [PATCH] Fixed: large memory-leaks when the encoder is closed.

Henrik Gramner henrik at gramner.com
Wed Jan 3 00:26:23 CET 2018


On Tue, Jan 2, 2018 at 11:31 PM, Boris Nagels <develop at focusware.nl> wrote:
> Calling x264_encoder_close() will also call x264_analyse_free_costs() to free up the allocated resources. The current implementation checks the wrong pointers if they're valid. This is because the pointers that are stored in the x264_t structure are shifted (see implementation for x264_analyse_init_costs()). This patch also stores the original pointers that were allocated, to be able to free the memory when the codec is closed. In the original implementation, this leads to memory-leaks and/or memory corruption when the encoder is opened/closed and reopened.

The pointers should only be wrong if h->param.analyse.i_mv_range
changes between encoder_open() and encoder_close() and I don't believe
mv-range can be reconfigured after the encoder has been opened.

valgrind does not indicate any errors or memory leaks for me.


More information about the x264-devel mailing list