Cleanup a place in the value_unload function#3820
Merged
rhc54 merged 1 commit intoopenpmix:v6.1from Feb 24, 2026
Merged
Conversation
The PMIx_Value unload function follows the format of the data in the pmix_value_t structure. If the data type in the pmix_value_t: 1. is a simple data field (e.g., a size_t), then we just copy the data across. The caller needs to provide the storage for the data. 2. is a pointer (e.g., the pmix_envar_t field), then we malloc the storage for the value, copy the fields into the new storage, and return that storage to the caller. The caller needs to provide storage for the pointer to the returned value. So in other words, the caller needs to provide storage (and a pointer to) the place where the final data is to be put. If it's a simple data field, the value will be placed in the provided storage. If it's a complex data field (e.g., a struct), then we will place the pointer to that malloc'd data in the provided storage. The byte_object and regex fields are complex data fields, but were violating the above rules. So fix those to be consistent, and add a more thorough check to catch violations. Signed-off-by: Ralph Castain <rhc@pmix.org> (cherry picked from commit 0ca2d6c)
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.
The PMIx_Value unload function follows the format of the data in the pmix_value_t structure. If the data type in the pmix_value_t:
is a simple data field (e.g., a size_t), then we just copy the data across. The caller needs to provide the storage for the data.
is a pointer (e.g., the pmix_envar_t field), then we malloc the storage for the value, copy the fields into the new storage, and return that storage to the caller. The caller needs to provide storage for the pointer to the returned value.
So in other words, the caller needs to provide storage (and a pointer to) the place where the final data is to be put. If it's a simple data field, the value will be placed in the provided storage. If it's a complex data field (e.g., a struct), then we will place the pointer to that malloc'd data in the provided storage.
The byte_object and regex fields are complex data fields, but were violating the above rules. So fix those to be consistent, and add a more thorough check to catch violations.
(cherry picked from commit 0ca2d6c)