opencryptoki / libica

Crypto library for s390x.
Other
9 stars 17 forks source link

Fix memory leak at library unload by uninstantiating global prng instance #85

Closed ifranzki closed 2 years ago

ifranzki commented 2 years ago

When built in non-FIPS mode, s390_prng_init() initializes a global PRNG instance in the library constructor, which must also be freed in the library destructor. Otherwise it leaks 64 bytes (direct leak) plus 240 bytes (indirect leak) when unloading the library.

jschmidb commented 2 years ago

Yep, that's a leak. How did you find it? Did you use a tool?

ifranzki commented 2 years ago

How did you find it?

The address sanitizer shows memory leaks. But you see this one only when you explicitly unload the library.