From 48fd3f62b964103f22031daed6e44970209a3372 Mon Sep 17 00:00:00 2001 From: Ilia K Date: Thu, 26 Feb 2015 13:28:58 +0000 Subject: [PATCH] Fix usage of shared_ptr for array which may cause a undefined behaviour (use unique_ptr instead) llvm-svn: 230630 --- lldb/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lldb/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp b/lldb/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp index 847adf1..650856f 100644 --- a/lldb/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp +++ b/lldb/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp @@ -948,14 +948,14 @@ CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStopException(void) const lldb::SBProcess sbProcess = CMICmnLLDBDebugSessionInfo::Instance().GetProcess(); lldb::SBThread sbThread = sbProcess.GetSelectedThread(); const size_t nStopDescriptionLen = sbThread.GetStopDescription(nullptr, 0); - std::shared_ptr spStopDescription(new char[nStopDescriptionLen]); - sbThread.GetStopDescription(spStopDescription.get(), nStopDescriptionLen); + std::unique_ptr apStopDescription(new char[nStopDescriptionLen]); + sbThread.GetStopDescription(apStopDescription.get(), nStopDescriptionLen); // MI print "*stopped,reason=\"exception-received\",exception=\"%s\",thread-id=\"%d\",stopped-threads=\"all\"" const CMICmnMIValueConst miValueConst("exception-received"); const CMICmnMIValueResult miValueResult("reason", miValueConst); CMICmnMIOutOfBandRecord miOutOfBandRecord(CMICmnMIOutOfBandRecord::eOutOfBand_Stopped, miValueResult); - const CMIUtilString strReason(spStopDescription.get()); + const CMIUtilString strReason(apStopDescription.get()); const CMICmnMIValueConst miValueConst2(strReason); const CMICmnMIValueResult miValueResult2("exception", miValueConst2); bool bOk = miOutOfBandRecord.Add(miValueResult2); -- 2.7.4