[LLDB][NFC] Fix memory leak in IntstumentationRuntimeTSan.cpp
authorSlava Gurevich <sgurevich@gmail.com>
Mon, 15 Aug 2022 09:25:42 +0000 (02:25 -0700)
committerSlava Gurevich <sgurevich@gmail.com>
Tue, 16 Aug 2022 21:34:50 +0000 (14:34 -0700)
commit1fe72001e8d69cae1975a360fee055c2fd3730f4
treed536af99354219ecb6701b05c65e61c2f5ca294a
parentd68ba43ad24791181280fdb0f34b6be380db7a32
[LLDB][NFC] Fix memory leak in IntstumentationRuntimeTSan.cpp

ConvertToStructuredArray() relies on its caller to deallocate the heap-allocated object pointer it returns. One of its call-sites, in GetRenumberedThreadIds(), fails to deallocate causing a memory/resource leak. Fix the memory leak by converting the return type to shared_ptr, and clean up the rest of the file to use the typedef-ed shared_ptr types for StructuredData for safety and consistency.

Differential Revision: https://reviews.llvm.org/D131900
lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp