westonpace opened a new pull request, #35347:
URL: https://github.com/apache/arrow/pull/35347

   ### Rationale for this change
   
   The current code has two storage buffers in the key map which are allocated 
with MemoryPool::Allocate which does not use smart pointers.  This could have 
led to a potential crash in an OOM scenario where the first allocate fails and 
it also led to some convoluted code keeping track of the previously allocated 
size in order to properly call Free.
   
   Furthermore, it seems that this key map could have been getting potentially 
copied in the swiss join code.  While that was probably not happening (since 
the copy happened before the key map was initialized) it is still an easy 
recipe for an accidental double-free later on as we maintain the class.
   
   ### What changes are included in this PR?
   
   Those raw buffers are changed to std::shared_ptr<Buffer> to avoid these 
issues.
   
   ### Are these changes tested?
   
   Somewhat, the existing unit tests should ensure we didn't cause a 
regression.  I didn't introduce a regression test to introduce this potential 
bug because it would be very difficult to do so.
   
   ### Are there any user-facing changes?
   
   No
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to