Author: ki.stfu
Date: Thu Feb 26 07:28:58 2015
New Revision: 230630
URL: http://llvm.org/viewvc/llvm-project?rev=230630&view=rev
Log:
Fix usage of shared_ptr for array which may cause a undefined behaviour (use
unique_ptr instead)
Modified:
lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
Modified: lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
URL:
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp?rev=230630&r1=230629&r2=230630&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp Thu Feb 26
07:28:58 2015
@@ -948,14 +948,14 @@ CMICmnLLDBDebuggerHandleEvents::HandlePr
const lldb::SBProcess sbProcess =
CMICmnLLDBDebugSessionInfo::Instance().GetProcess();
lldb::SBThread sbThread = sbProcess.GetSelectedThread();
const size_t nStopDescriptionLen = sbThread.GetStopDescription(nullptr, 0);
- std::shared_ptr<char> spStopDescription(new char[nStopDescriptionLen]);
- sbThread.GetStopDescription(spStopDescription.get(), nStopDescriptionLen);
+ std::unique_ptr<char[]> 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);
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits