Skip to content

Comments

gh-145200: Fix EVP_MAC_CTX leak in hashlib HMAC on init failure#145201

Open
raminfp wants to merge 4 commits intopython:mainfrom
raminfp:fix-gh-145200-hashlib-hmac-ctx-leak
Open

gh-145200: Fix EVP_MAC_CTX leak in hashlib HMAC on init failure#145201
raminfp wants to merge 4 commits intopython:mainfrom
raminfp:fix-gh-145200-hashlib-hmac-ctx-leak

Conversation

@raminfp
Copy link
Contributor

@raminfp raminfp commented Feb 25, 2026

Free the EVP_MAC_CTX (or HMAC_CTX) when EVP_MAC_init() (or HMAC_Init_ex()) fails in hashlib_HMAC_CTX_new_from_digestmod(), preventing a memory leak on every failed call.

raminfp and others added 2 commits February 25, 2026 12:16
…_4PAtcI.rst

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@raminfp raminfp requested a review from picnixz February 25, 2026 08:47
Copy link
Member

@picnixz picnixz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a minor doc tweak.

…_4PAtcI.rst

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@picnixz
Copy link
Member

picnixz commented Feb 25, 2026

I'm going to run the refleak bots just in case so don't commit anything until the tests are done, TiA!

@picnixz picnixz added the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label Feb 25, 2026
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @picnixz for commit b175558 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F145201%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-refleak-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants