Skip to content

clover: fix clLinkProgram() memory leak after error

What does this MR do and why?

clover: fix clLinkProgram() memory leak after error

Indeed, the object prog is not freed when an error occurs.

For instance, this issue is triggered with "piglit/bin/cl-api-link-program":
Direct leak of 136 byte(s) in 1 object(s) allocated from:
    #0 0x7f5a47f86f57 in operator new(unsigned long) (/usr/lib64/libasan.so.6+0xb2f57)
    #1 0x7f5a31a922c8 in clover::intrusive_ref<clover::program> clover::create<clover::program, clover::context&, clover::ref_vector<clover::device>&>(clover::context&, clover::ref_vector<clover::device>&) ../src/gallium/frontends/clover/util/pointer.hpp:241
    #2 0x7f5a31ab1fc0 in clLinkProgram ../src/gallium/frontends/clover/api/program.cpp:436
...
SUMMARY: AddressSanitizer: 12410 byte(s) leaked in 165 allocation(s).

Fixes: f29ed2da2423 ("clover: Add clLinkProgram (CL 1.2).")
Signed-off-by: Patrick Lerda <patrick9876@free.fr>

Merge request reports

Loading