Skip to content

Don't declare WC_ALLOC_DO_ON_FAILURE by default#9905

Open
julek-wolfssl wants to merge 1 commit intowolfSSL:masterfrom
julek-wolfssl:WC_ALLOC_DO_ON_FAILURE-cleanup
Open

Don't declare WC_ALLOC_DO_ON_FAILURE by default#9905
julek-wolfssl wants to merge 1 commit intowolfSSL:masterfrom
julek-wolfssl:WC_ALLOC_DO_ON_FAILURE-cleanup

Conversation

@julek-wolfssl
Copy link
Member

No description provided.

@julek-wolfssl julek-wolfssl self-assigned this Mar 6, 2026
Copilot AI review requested due to automatic review settings March 6, 2026 09:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates allocation-failure handling by removing the default WC_ALLOC_DO_ON_FAILURE definition from the core header and making tests explicitly define (or avoid relying on) that behavior.

Changes:

  • Removed the default WC_ALLOC_DO_ON_FAILURE() definition from wolfssl/wolfcrypt/types.h.
  • Added explicit WC_ALLOC_DO_ON_FAILURE() definitions in select test files.
  • Updated Chacha API test to use WC_ALLOC_VAR_EX/WC_FREE_VAR_EX with explicit failure/cleanup handling.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
wolfssl/wolfcrypt/types.h Removes default allocation-failure hook macro from a public header.
wolfcrypt/test/test.c Adds a local WC_ALLOC_DO_ON_FAILURE() definition for tests.
tests/api/test_rsa.c Defines WC_ALLOC_DO_ON_FAILURE() for RSA API tests.
tests/api/test_aes.c Defines WC_ALLOC_DO_ON_FAILURE() for AES API tests.
tests/api/test_chacha.c Switches to _EX alloc/free macros and adds a cleanup path on allocation failure.
Comments suppressed due to low confidence (1)

wolfcrypt/test/test.c:1

  • WC_ALLOC_DO_ON_FAILURE() is defined mid-file (and apparently inside a function body). With the default removed from types.h, any WC_ALLOC_VAR usages earlier in this translation unit will no longer see this macro and may fail to compile. Define this at file scope near the top of the file (or in a shared test header included before any uses) so it consistently applies to the entire compilation unit.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

3 participants