SBAddress constructor accepts a pointer to lldb_private::Address, but then dereferences it and copies the value. Allocating a temporary here leads to a memory leak.
Found via ASan:
Direct leak of 24 byte(s) in 1 object(s) allocated from:
#0 0x7fc70451e19f in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10919f) #1 0x7fc6fdb560b4 in lldb::SBValue::GetAddress() /home/werat/git/llvm-project-upstream/lldb/source/API/SBValue.cpp:1359 #2 0x7fc6fdb06714 in lldb::SBType::operator=(lldb::SBType const&) /home/werat/git/llvm-project-upstream/lldb/source/API/SBType.cpp:83 ...
clang-tidy: error: 'lldb/API/SBValue.h' file not found [clang-diagnostic-error]
not useful