Skip to content

Fix nightly mem#10139

Merged
JacobBarthelmeh merged 2 commits intowolfSSL:masterfrom
philljj:fix_nightly_mem
Apr 7, 2026
Merged

Fix nightly mem#10139
JacobBarthelmeh merged 2 commits intowolfSSL:masterfrom
philljj:fix_nightly_mem

Conversation

@philljj
Copy link
Copy Markdown
Contributor

@philljj philljj commented Apr 6, 2026

Description

Use XFREE for buffer that came from XMALLOC in load_file().

Fixes some free(): invalid pointer errors from mem test.

Testing:

@philljj philljj self-assigned this Apr 6, 2026
Copilot AI review requested due to automatic review settings April 6, 2026 19:32
Copy link
Copy Markdown
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

Note

Copilot was unable to run its full agentic suite in this review.

Updates test cleanup paths to use wolfSSL’s allocator/free macros consistently, addressing invalid frees in nightly memory tests.

Changes:

  • Replace free() with XFREE() for buffers presumed to be allocated via XMALLOC()/load_file().
  • Align test teardown with wolfSSL memory tracking to reduce free(): invalid pointer errors.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/api/test_pkcs7.c Switches cert_buf deallocation from free() to XFREE() in a PKCS7 decode test cleanup path.
tests/api.c Switches serverKey deallocation from free() to XFREE() in two dual-alg test cleanup paths.
Comments suppressed due to low confidence (1)

tests/api.c:1

  • XFREE's third argument (dynamic type) should match the type used when allocating serverKey (likely inside load_file()). If load_file() uses a different DYNAMIC_TYPE_* for this buffer, this change can still cause allocator/debug-tracking issues even if it compiles. Please update the DYNAMIC_TYPE_* here to exactly match the allocation site’s type (or use a dedicated load_file_free() helper to centralize the correct XFREE parameters).

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

@philljj
Copy link
Copy Markdown
Contributor Author

philljj commented Apr 7, 2026

Retest this please.

Unclear what is cause of error.

@philljj philljj added the For This Release Release version 5.9.1 label Apr 7, 2026
@philljj philljj assigned wolfSSL-Bot and unassigned philljj Apr 7, 2026
@JacobBarthelmeh JacobBarthelmeh merged commit 7aac9e5 into wolfSSL:master Apr 7, 2026
474 of 475 checks passed
@philljj philljj deleted the fix_nightly_mem branch April 7, 2026 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For This Release Release version 5.9.1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants