From: Remi Gacogne Date: Tue, 2 Apr 2024 14:20:14 +0000 (+0200) Subject: auth: Properly finalize PKCS11 modules before releasing them X-Git-Tag: rec-5.1.0-alpha1~63^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3c6d9aacd96a099e450545a21020fa8efec9538b;p=thirdparty%2Fpdns.git auth: Properly finalize PKCS11 modules before releasing them This gets rid of two leaks reported by LeakSanitizer when running our unit tests: ``` Direct leak of 48 byte(s) in 1 object(s) allocated from: #0 0x5fe6c6e7d099 in malloc (/pdns/pdns/testrunner+0x220099) (BuildId: 08d4c369b5f2f19f183aa5d6ab931a6653b70ab9) #1 0x7e6cdc6a0964 (/usr/lib/libp11-kit.so.0+0x36964) (BuildId: 307da6c0b5c7d87a1b0fd0a63e0bda93c9375e8a) Indirect leak of 72 byte(s) in 1 object(s) allocated from: #0 0x5fe6c6e7d401 in calloc (/pdns/pdns/testrunner+0x220401) (BuildId: 08d4c369b5f2f19f183aa5d6ab931a6653b70ab9) #1 0x7e6cdc6a09b6 (/usr/lib/libp11-kit.so.0+0x369b6) (BuildId: 307da6c0b5c7d87a1b0fd0a63e0bda93c9375e8a) ``` --- diff --git a/pdns/pkcs11signers.cc b/pdns/pkcs11signers.cc index dc53f29307..01b1625e70 100644 --- a/pdns/pkcs11signers.cc +++ b/pdns/pkcs11signers.cc @@ -1030,7 +1030,7 @@ namespace { }; ~LoaderStruct() { #ifdef HAVE_P11KIT1_V2 - p11_kit_modules_release(p11_modules); + p11_kit_modules_finalize_and_release(p11_modules); #else p11_kit_finalize_registered(); #endif