Leak when setting no-sao

Issue #601 new
Ade Miller created an issue

Seems like setting “no-sao” causes the FrameFilter to never call SAO::destroy. I’m still trying to step through the code and figure out exactly what’s going on but I only see these leaks when SAO is turned off.

I think this is a small leak but it make it hard to build and test my application with asan or Valgrind as they both detect this. I’m building version 3.5.

==5160==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 8496 byte(s) in 24 object(s) allocated from:
    #0 0x7f6138faadb0 in posix_memalign (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xeedb0)
    #1 0x55de8dbc814b in x265::x265_malloc(unsigned long) ../../third_party/libx265/source/common/common.cpp:81
    #2 0x55de8dd05087 in x265::SAO::create(x265_param*, int) ../../third_party/libx265/source/encoder/sao.cpp:115
    #3 0x55de8dcf8f6b in x265::FrameFilter::init(x265::Encoder*, x265::FrameEncoder*, int, unsigned int) ../../third_party/libx265/source/encoder/framefilter.cpp:203
    #4 0x55de8dcd3c80 in x265::FrameEncoder::init(x265::Encoder*, int, int) ../../third_party/libx265/source/encoder/frameencoder.cpp:173
    #5 0x55de8dbfcb0e in x265::Encoder::create() ../../third_party/libx265/source/encoder/encoder.cpp:451
    #6 0x55de8dbc9143 in x265_encoder_open_200 ../../third_party/libx265/source/encoder/api.cpp:195
    #7 0x55de8d39202e in libx265_encode_init ../../third_party/ffmpeg/libavcodec/libx265.c:377

Direct leak of 792 byte(s) in 24 object(s) allocated from:
    #0 0x7f6138faadb0 in posix_memalign (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xeedb0)
    #1 0x55de8dbc814b in x265::x265_malloc(unsigned long) ../../third_party/libx265/source/common/common.cpp:81
    #2 0x55de8dd04cd3 in x265::SAO::create(x265_param*, int) ../../third_party/libx265/source/encoder/sao.cpp:110
    #3 0x55de8dcf8f6b in x265::FrameFilter::init(x265::Encoder*, x265::FrameEncoder*, int, unsigned int) ../../third_party/libx265/source/encoder/framefilter.cpp:203
    #4 0x55de8dcd3c80 in x265::FrameEncoder::init(x265::Encoder*, int, int) ../../third_party/libx265/source/encoder/frameencoder.cpp:173
    #5 0x55de8dbfcb0e in x265::Encoder::create() ../../third_party/libx265/source/encoder/encoder.cpp:451
    #6 0x55de8dbc9143 in x265_encoder_open_200 ../../third_party/libx265/source/encoder/api.cpp:195
    #7 0x55de8d39202e in libx265_encode_init ../../third_party/ffmpeg/libavcodec/libx265.c:377

Direct leak of 792 byte(s) in 24 object(s) allocated from:
    #0 0x7f6138faadb0 in posix_memalign (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xeedb0)
    #1 0x55de8dbc814b in x265::x265_malloc(unsigned long) ../../third_party/libx265/source/common/common.cpp:81
    #2 0x55de8dd04e86 in x265::SAO::create(x265_param*, int) ../../third_party/libx265/source/encoder/sao.cpp:111
    #3 0x55de8dcf8f6b in x265::FrameFilter::init(x265::Encoder*, x265::FrameEncoder*, int, unsigned int) ../../third_party/libx265/source/encoder/framefilter.cpp:203
    #4 0x55de8dcd3c80 in x265::FrameEncoder::init(x265::Encoder*, int, int) ../../third_party/libx265/source/encoder/frameencoder.cpp:173
    #5 0x55de8dbfcb0e in x265::Encoder::create() ../../third_party/libx265/source/encoder/encoder.cpp:451
    #6 0x55de8dbc9143 in x265_encoder_open_200 ../../third_party/libx265/source/encoder/api.cpp:195
    #7 0x55de8d39202e in libx265_encode_init ../../third_party/ffmpeg/libavcodec/libx265.c:377

Direct leak of 509 byte(s) in 1 object(s) allocated from:
    #0 0x7f6138faadb0 in posix_memalign (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xeedb0)
    #1 0x55de8dbc814b in x265::x265_malloc(unsigned long) ../../third_party/libx265/source/common/common.cpp:81
    #2 0x55de8dd0579e in x265::SAO::create(x265_param*, int) ../../third_party/libx265/source/encoder/sao.cpp:137
    #3 0x55de8dcf8f6b in x265::FrameFilter::init(x265::Encoder*, x265::FrameEncoder*, int, unsigned int) ../../third_party/libx265/source/encoder/framefilter.cpp:203
    #4 0x55de8dcd3c80 in x265::FrameEncoder::init(x265::Encoder*, int, int) ../../third_party/libx265/source/encoder/frameencoder.cpp:173
    #5 0x55de8dbfcb0e in x265::Encoder::create() ../../third_party/libx265/source/encoder/encoder.cpp:451
    #6 0x55de8dbc9143 in x265_encoder_open_200 ../../third_party/libx265/source/encoder/api.cpp:195
    #7 0x55de8d39202e in libx265_encode_init ../../third_party/ffmpeg/libavcodec/libx265.c:377

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x7f6138faadb0 in posix_memalign (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xeedb0)
    #1 0x55de8dbc814b in x265::x265_malloc(unsigned long) ../../third_party/libx265/source/common/common.cpp:81
    #2 0x55de8dd05523 in x265::SAO::create(x265_param*, int) ../../third_party/libx265/source/encoder/sao.cpp:126
    #3 0x55de8dcf8f6b in x265::FrameFilter::init(x265::Encoder*, x265::FrameEncoder*, int, unsigned int) ../../third_party/libx265/source/encoder/framefilter.cpp:203
    #4 0x55de8dcd3c80 in x265::FrameEncoder::init(x265::Encoder*, int, int) ../../third_party/libx265/source/encoder/frameencoder.cpp:173
    #5 0x55de8dbfcb0e in x265::Encoder::create() ../../third_party/libx265/source/encoder/encoder.cpp:451
    #6 0x55de8dbc9143 in x265_encoder_open_200 ../../third_party/libx265/source/encoder/api.cpp:195
    #7 0x55de8d39202e in libx265_encode_init ../../third_party/ffmpeg/libavcodec/libx265.c:377

SUMMARY: AddressSanitizer: 10653 byte(s) leaked in 74 allocation(s).

Comments (3)

  1. DaDaLynn

    I encountered exactly the same problem(to turn sao off caused function SAO::destroy not being called in FrameFilter::destroy) , and so l had to turn sao on……

  2. Log in to comment