Skip to content

Cleanup a place in the value_unload function#3820

Merged
rhc54 merged 1 commit intoopenpmix:v6.1from
rhc54:cmr61/unload
Feb 24, 2026
Merged

Cleanup a place in the value_unload function#3820
rhc54 merged 1 commit intoopenpmix:v6.1from
rhc54:cmr61/unload

Conversation

@rhc54
Copy link
Contributor

@rhc54 rhc54 commented Feb 24, 2026

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.

(cherry picked from commit 0ca2d6c)

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)
@rhc54 rhc54 merged commit 4bf58b3 into openpmix:v6.1 Feb 24, 2026
26 checks passed
@rhc54 rhc54 deleted the cmr61/unload branch February 24, 2026 19:19
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