]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
erasure-code/jerasure: fix memory leak in Galois field operations
authorKefu Chai <tchaikov@gmail.com>
Fri, 27 Jun 2025 13:56:23 +0000 (21:56 +0800)
committerKefu Chai <tchaikov@gmail.com>
Thu, 10 Jul 2025 09:31:13 +0000 (17:31 +0800)
commit08d7363fb2e7371bac331cbcdc693a092e6f6fad
treebf8313d44b607932fb3ce934826c7917dfeaddad
parent25803eccf2f6792983b25e2146f19ba17851cd97
erasure-code/jerasure: fix memory leak in Galois field operations

Fix a memory leak where Galois field acceleration functions created by
ErasureCodeJerasure::prepare() were never freed. ASan detected this as
a one-time leak when the plugin was unloaded.

Add jerasure_finish() destructor function in jerasure_init.cc to free
the allocated Galois field operations. Since jerasure_init.cc and
galois.c are built into the same object library, jerasure_finish() can
access and clean up the global static acceleration functions defined
in galois.c.

The destructor function is automatically called when the shared library
(plugin) is unloaded, ensuring proper cleanup without requiring explicit
calls from client code.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/erasure-code/jerasure/jerasure_init.cc
src/erasure-code/jerasure/jerasure_init.h