refactor: remove dead EVP_PKEY_CTX_free(pctx) calls#127
Merged
timlegge merged 1 commit intocpan-authors:mainfrom Mar 21, 2026
Merged
refactor: remove dead EVP_PKEY_CTX_free(pctx) calls#127timlegge merged 1 commit intocpan-authors:mainfrom
timlegge merged 1 commit intocpan-authors:mainfrom
Conversation
…ters() Both calls were unreachable: pctx is always freed and NULLed before these points — at line 738/761 on success paths, and at line 784 in the err: cleanup block. Removing them clarifies resource ownership and eliminates misleading cleanup code. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
timlegge
approved these changes
Mar 21, 2026
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
Remove two unreachable
EVP_PKEY_CTX_free(pctx)calls in_new_key_from_parameters().Why
Both calls operate on a guaranteed-NULL pointer. The
pctxresource is already freed and NULLed:err:cleanup blockThe dead calls at lines 792 (inside
if (error)) and 799 (atend:label) obscure the actual resource ownership flow and suggest cleanup is still needed when it isn't.How
Deleted 6 lines — the two
EVP_PKEY_CTX_free(pctx)calls and their#ifguards. No behavioral change.Testing
460 tests pass before and after (macOS, OpenSSL 3.x).
🤖 Generated with Claude Code
Quality Report
Changes: 1 file changed, 6 deletions(-)
Code scan: clean
Tests: passed (OK)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline