From 8927f23abdeb6abc064ff53de41b8442c5f7f723 Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Sun, 13 Nov 2016 03:36:01 +0000 Subject: [PATCH] Fix some use-after-frees that my last CL introduced. llvm-svn: 286745 --- lldb/include/lldb/Host/XML.h | 4 ++-- lldb/source/Host/common/XML.cpp | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lldb/include/lldb/Host/XML.h b/lldb/include/lldb/Host/XML.h index c023739..4113b33 100644 --- a/lldb/include/lldb/Host/XML.h +++ b/lldb/include/lldb/Host/XML.h @@ -139,7 +139,7 @@ public: //---------------------------------------------------------------------- XMLNode GetRootElement(const char *required_name = nullptr); - const std::string &GetErrors() const; + llvm::StringRef GetErrors() const; static void ErrorCallback(void *ctx, const char *format, ...); @@ -160,7 +160,7 @@ public: bool ParseFile(const char *path); - const std::string &GetErrors() const; + llvm::StringRef GetErrors() const; explicit operator bool() const { return IsValid(); } diff --git a/lldb/source/Host/common/XML.cpp b/lldb/source/Host/common/XML.cpp index 39a0323..c637d93 100644 --- a/lldb/source/Host/common/XML.cpp +++ b/lldb/source/Host/common/XML.cpp @@ -79,9 +79,7 @@ XMLNode XMLDocument::GetRootElement(const char *required_name) { return XMLNode(); } -const std::string &XMLDocument::GetErrors() const { - return m_errors.GetString(); -} +llvm::StringRef XMLDocument::GetErrors() const { return m_errors.GetString(); } bool XMLDocument::XMLEnabled() { #if defined(LIBXML2_DEFINED) @@ -391,7 +389,7 @@ ApplePropertyList::ApplePropertyList(const char *path) ApplePropertyList::~ApplePropertyList() {} -const std::string &ApplePropertyList::GetErrors() const { +llvm::StringRef ApplePropertyList::GetErrors() const { return m_xml_doc.GetErrors(); } -- 2.7.4