Fix incorrect memory freeing in build_pkcs11_uri() - #11
Open
andersm wants to merge 1 commit into
Open
Conversation
The function build_pkcs11_uri() tries to free memory it should not. The variable pkcs11_token_pin points to memory owned by the C library, and freeing it can cause a segfault. The variable pkcs11_uri holds the return value. Calling the FREE() macro on the variable made the function always return a NULL pointer. The variable env_result is unnecessarily freed twice.
Contributor
|
Thank you, @andersm, we are working on this issue and running tests |
Closed
Contributor
utkarshguptanxp
pushed a commit
that referenced
this pull request
Aug 14, 2026
- Use a const pointer to prevent modification of memory returned by getenv(). - Free env_result before reassigning it to prevent invalid memory operations and memory leaks. Issue originally reported in PR #11. Reported-by: @andersm Signed-off-by: Mario Castaneda <mario.ignacio.castaneda.lopez@nxp.com>
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.
Fix some memory handling errors introduced in 1c477bd.
Since the build_pkcs11_uri() function could not possibly return a valid URI, have those changes been tested at all?