fix: free EVP_PKEY_CTX leak in _new_key_from_parameters()#87
Merged
atoomic merged 1 commit intoMar 16, 2026
Merged
Conversation
3 tasks
timlegge
approved these changes
Mar 15, 2026
Member
|
Approved |
Collaborator
|
@Koan-Bot rebase |
Contributor
Author
Rebase: fix: free EVP_PKEY_CTX leak in _new_key_from_parameters()Branch Diff: 1 file changed, 2 insertions(+), 2 deletions(-) Review feedback was analyzed and applied. Actions
Automated by Kōan |
809044c to
8ff2ab7
Compare
Koan-Bot
added a commit
to Koan-Bot/koan
that referenced
this pull request
Mar 15, 2026
When a project has both an origin (fork) and upstream remote, the rebase code tried origin first. If origin/main was stale (common for forks), git rebase would replay all upstream commits as new branch commits, producing PRs with dozens of spurious commits. Add _find_remote_for_repo() to match the PR's target repository (owner/repo) against local git remote URLs, then prioritize that remote for the rebase. Falls back to origin/upstream if no match. Applied the same fix to: - rebase_pr._rebase_with_conflict_resolution (primary fix) - claude_step._rebase_onto_target (used by pr_review.py) - pr_review.run_pr_review (passes preferred remote through) Fixes: cpan-authors/Crypt-OpenSSL-RSA#87 (57 commits after rebase) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Member
|
@Koan-Bot rebase |
Collaborator
|
@timlegge there was a bug with my rebase strategy, this is now fixed I think and as you can see above you can give instructions to the bot |
test_ctx allocated via EVP_PKEY_CTX_new_from_pkey() at line 649 was never freed on either success or error paths (OpenSSL 3.x only). Save the EVP_PKEY_check() result, free test_ctx immediately, then THROW on failure. Also guard against NULL test_ctx before calling EVP_PKEY_check. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
Rebase: fix: free EVP_PKEY_CTX leak in _new_key_from_parameters()Branch Diff: 1 file changed, 2 insertions(+), 2 deletions(-) Review feedback was analyzed and applied. Actions
Automated by Kōan |
8ff2ab7 to
19a244c
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Free
test_ctxEVP_PKEY_CTX that was leaked on every call to_new_key_from_parameters()(OpenSSL 3.x only).Why
EVP_PKEY_CTX_new_from_pkey()at RSA.xs:649 allocates a context forEVP_PKEY_check(), but it was never freed — neither on the success path nor via theerr:cleanup label. Every key construction from parameters leaked oneEVP_PKEY_CTX.How
Save the
EVP_PKEY_check()result, freetest_ctximmediately after, thenTHROWon failure. Also guards against NULLtest_ctxbefore callingEVP_PKEY_check(defensive —EVP_PKEY_CTX_free(NULL)is a no-op).Testing
make test— 281 tests pass. The fix is a straightforward resource cleanup with no behavioral change.🤖 Generated with Claude Code
Quality Report
Changes: 1 file changed, 3 insertions(+), 1 deletion(-)
Code scan: clean
Tests: passed (OK)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline