Skip to content

Fix memory leaks in key_to_ECC#319

Open
saiashok0981 wants to merge 1 commit into
ccc-certifier-framework:mainfrom
saiashok0981:fix-key-to-ecc-memory-leaks
Open

Fix memory leaks in key_to_ECC#319
saiashok0981 wants to merge 1 commit into
ccc-certifier-framework:mainfrom
saiashok0981:fix-key-to-ecc-memory-leaks

Conversation

@saiashok0981

Copy link
Copy Markdown

Summary

This PR addresses memory leaks in key_to_ECC (located in src/support.cc).

Proposed Changes

  • Ensures that all helper BIGNUM allocations (priv_mult, p_pt_x, p_pt_y) and EC_POINT (pt) are freed using BN_free / EC_POINT_free once they are loaded/copied into the main ecc_key.
  • Frees BN_CTX (ctx) on all code paths (both success and failure).
  • Frees ecc_key (EC_KEY_free(ecc_key)) on failure paths before returning nullptr.
  • Uses a unified cleanup label (done:) to ensure no leaks occur regardless of where failure is triggered.

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