Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib-dcrypt, mail-crypt: Fix leaking memory when using non-global keys
The users' private keys had one reference too much. Because of key cache, most likely the keys were leaked only once at deinit. Changed the i_stream_create_decrypt_callback() API so that it allows the callback to create the key itself without having to store it anywhere. In this case the key was already added to cache, which increased its refcount. So an alternative fix would have been to simply unreferenced the key before returning it. It's a bit ugly though to rely on such caches, since without the cache the code would be buggy.
- Loading branch information
Showing
4 changed files
with
16 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters