[c++] Fix memory-management issues in new domainish helpers #3030
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.
Issue and/or context: Found while debugging memory-management issues on #3027 for #2407 / [sc-51048].
Changes:
The new
libtiledbsoma
helpers used by #3027 were incorrectly pairingnew
andfree
, as immediately revealed by my runningvalgrind build/libtiledbsoma/test/unit_soma
while debugging some issues on #3027. There are code comments saying to usenew
to match the releaser callbacks, but these are incorrect -- the releaser callbacks are usingfree
.I also took the opportunity to check the
ArrowArray
andArrowSchema
structs and ensure I was setting all missing attributes to 0 ornullptr
, respectively.Notes for Reviewer:
It might be simpler to make use of
memset(arrow_array, 0, sizeof(ArrowArray)
andmemset(arrow_schema, 0, sizeof(ArrowSchema)
right after the allocs, to avoid all the onesie-twosie setting of non-relevant attributes to 0 ornullptr
, respectively.