Fix leak in the buffer vectorMembers when reading SIO frames #589
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.
BEGINRELEASENOTES
ENDRELEASENOTES
The leak happens because at the time of this
emplace_back
, there is already an element in the vector with the string corresponding to that vector member. Then, the indexing will only find the first instance and this second one is leaked, so the fix is to check before and only if it isn't there add it. I think this is added for the first time in https://github.com/AIDASoft/podio/blob/master/python/templates/SIOBlock.cc.jinja2#L92This helps with the
read_frame_sio
test. Before:After:
I'm not sure if we need a test since
read_frame_sio
would be the one, once it doesn't have any leaks. Otherwise to reproduce we just have to read a frame with a collection with a vector member.I did this one because after this I have a version of #583 without leaks.