Fix leak in the buffer vectorMembers when reading SIO frames
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#L92
This helps with the read_frame_sio test. Before:
SUMMARY: AddressSanitizer: 12714 byte(s) leaked in 482 allocation(s).
After:
SUMMARY: AddressSanitizer: 11786 byte(s) leaked in 445 allocation(s).
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.
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 https://github.com/AIDASoft/podio/pull/583 without leaks.