[Lldb-commits] [lldb] [lldb][test] Free buffers in demangling tests to avoid leaks (PR #142676)

Jordan Rupprecht via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 4 10:00:57 PDT 2025


rupprecht wrote:

> LGTM. Maybe an opportunity to use a unique_ptr with a custom deleter? Something like:
> 
> ```
> struct TrackingOutputBufferDeleter {
>   void operator()(TrackingOutputBuffer* TOB) {
>     if (!TOB)
>       return;
>     std::free(TOB->getBuffer());
>     std::free(TOB);
>   }
> };
> ```

Sent #142815. The suggestion is almost perfect. The buffer can be free'd, but TOB must be deleted, otherwise there's a mismatch: `alloc-dealloc-mismatch (operator new vs free)`.

https://github.com/llvm/llvm-project/pull/142676


More information about the lldb-commits mailing list