Skip to content

Commit

Permalink
auth: Properly finalize PKCS11 modules before releasing them
Browse files Browse the repository at this point in the history
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)
```
  • Loading branch information
rgacogne committed Apr 4, 2024
1 parent e472f31 commit 3c6d9aa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pdns/pkcs11signers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3c6d9aa

Please sign in to comment.