Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decrement ref counter only once on key object free #528

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pugo
Copy link

@pugo pugo commented Mar 13, 2024

This is a suggested solution to the issue I describe in issue #527.

By moving the decrement of obj->refcnt to after the if-section for obj->evp_key the counter will not be decremented twice if obj->evp_key is true and we get another call as result of the EVP_PKEY_free().

Without this patch the decrement will be done twice and the comparison with 0 will fail since the value goes negative. This means that the cleanup code at the end is never run.

As far as I can see there shouldn't be scenarios where the current behavior is wanted, but I of course do not have the big picture as clear as you have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant