From 1c1ffa6a300a60c81be41a3e08a4e9da7499adc1 Mon Sep 17 00:00:00 2001 From: Jim Ingham Date: Wed, 5 Aug 2020 19:12:15 -0700 Subject: [PATCH] GetPath() returns a std::string temporary. You can't reference just the c_str. Found by the static analyzer. --- lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index 338c798..383cc5b 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -1887,15 +1887,15 @@ public: m_section_infos[n_sect].vm_range.SetByteSize( section_sp->GetByteSize()); } else { - const char *filename = ""; + std::string filename = ""; SectionSP first_section_sp(m_section_list->GetSectionAtIndex(0)); if (first_section_sp) - filename = first_section_sp->GetObjectFile()->GetFileSpec().GetPath().c_str(); + filename = first_section_sp->GetObjectFile()->GetFileSpec().GetPath(); Host::SystemLog(Host::eSystemLogError, "error: unable to find section %d for a symbol in %s, corrupt file?\n", n_sect, - filename); + filename.c_str()); } } if (m_section_infos[n_sect].vm_range.Contains(file_addr)) { -- 2.7.4