Fix some use-after-frees that my last CL introduced.
authorZachary Turner <zturner@google.com>
Sun, 13 Nov 2016 03:36:01 +0000 (03:36 +0000)
committerZachary Turner <zturner@google.com>
Sun, 13 Nov 2016 03:36:01 +0000 (03:36 +0000)
llvm-svn: 286745

lldb/include/lldb/Host/XML.h
lldb/source/Host/common/XML.cpp

index c023739..4113b33 100644 (file)
@@ -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(); }
 
index 39a0323..c637d93 100644 (file)
@@ -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();
 }